Carousel
How do I make an carousel?
What is a carousel? How do you make a carousel? This script and codes were developed by Lisa Macken on 01 October 2022, Saturday.
Carousel - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Carousel</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <html> <head> <title>jQuery Content Slider</title> <link rel="stylesheet" href="css/style.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript" src="js/script.js"></script> </head> <body> <div id="container"> <header> <h1>jQuery Content Slider</h1> </header> <img src="img/arrow-left.png" alt="Prev" id="prev"> <div id="slider"> <div class="slide"> <div class="slide-copy"> <h2>Slider One</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae commodo sem. Integer eros nibh, molestie congue elementum quis, mattis nec tortor. Vivamus sed hendrerit sed vitae orci convallis.</p> </div> <img src="img/slide1.jpg"> </div> <div class="slide"> <div class="slide-copy"> <h2>Slider Two</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae commodo sem. Integer eros nibh, molestie congue elementum quis, mattis nec tortor. Vivamus sed hendrerit sed vitae orci convallis.</p> </div> <img src="img/slide2.jpg"> </div> <div class="slide"> <div class="slide-copy"> <h2>Slider Three</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae commodo sem. Integer eros nibh, molestie congue elementum quis, mattis nec tortor. Vivamus sed hendrerit sed vitae orci convallis.</p> </div> <img src="img/slide3.jpg"> </div> <div class="slide"> <div class="slide-copy"> <h2>Slider Four</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae commodo sem. Integer eros nibh, molestie congue elementum quis, mattis nec tortor. Vivamus sed hendrerit sed vitae orci convallis.</p> </div> <img src="img/slide4.jpg"> </div> <div class="slide"> <div class="slide-copy"> <h2>Slider Five</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae commodo sem. Integer eros nibh, molestie congue elementum quis, mattis nec tortor. Vivamus sed hendrerit sed vitae orci convallis.</p> </div> <img src="img/slide5.jpg"> </div> </div> <img src="img/arrow-right.png" alt="Next" id="next"> </div> </body>
</html> <script src="js/index.js"></script>
</body>
</html>
Carousel - Script Codes CSS Codes
*{ margin:0; padding:0;
}
body{ font-family:'Arial', sans-serif; font-size:14px; color:#fff; background:#333; line-height:1.6em;
}
a{ color:#fff; text-decoration:none;
}
h1{ text-align:center; margin-bottom:20px;
}
#container{ width:980px; margin:40px auto; overflow:hidden;
}
#slider{ width:940px; height:350px; position:relative; overflow:hidden; float:left; padding:3px; border:#666 solid 2px; border-radius:5px;
}
#slider img{ width:940px; height:350px;
}
.slide{ position:absolute;
}
.slide-copy{ position:absolute; bottom:0; left:0; padding:20px; background:7f7f7f; background: rgba(0,0,0,0.5);
}
#prev, #next{ float:left; margin-top:130px; cursor:pointer; position:relative; z-index:100;
}
#prev{ margin-right:-45px;
}
#next{ margin-left:-45px;
}
Carousel - Script Codes JS Codes
$(document).ready(function(){ // Set options var speed = 500; // fade speed var autoswitch = true; // auto slider option var autoswitch_speed = 4000; // auto slider speed // Add initial active class $('.slide').first().addClass('active'); // Hide all slides $('.slide').hide(); // Show first slide $('.active').show(); // next handler $('#next').on('click', nextSlide); $('#prev').on('click', prevSlide); // Auto slider handler if(autoswitch == true){ setInterval(nextSlide,autoswitch_speed); } // Switch to the next slide function nextSlide(){ $('.active').removeClass('active').addClass('oldActive'); if($('.oldActive').is(':last-child')){ $('.slide').first().addClass('active'); } else { $('.oldActive').next().addClass('active'); } $('.oldActive').removeClass('oldActive'); $('.slide').fadeOut(speed); $('.active').fadeIn(speed); } function prevSlide(){ $('.active').removeClass('active').addClass('oldActive'); if($('.oldActive').is(':first-child')){ $('.slide').last().addClass('active'); } else { $('.oldActive').prev().addClass('active'); } $('.oldActive').removeClass('oldActive'); $('.slide').fadeOut(speed); $('.active').fadeIn(speed); }
});
Developer | Lisa Macken |
Username | lmack90 |
Uploaded | October 01, 2022 |
Rating | 3 |
Size | 2,620 Kb |
Views | 28,336 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Scrollable svg Animations | 2,980 Kb |
CodeCamp - Front-End Challenge | 2,107 Kb |
A Pen by Lisa Macken | 2,231 Kb |
Animation examples | 1,850 Kb |
JQuery Accordian Slider | 2,456 Kb |
A JQuery Mobile Quiz Game | 4,406 Kb |
Image moves with mouse | 1,974 Kb |
RollOver Effect 2 | 2,162 Kb |
SVG icons | 3,809 Kb |
SmoothScroll Navigation 2 | 2,888 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Waveform function for a siren tone modulation | Clafou | 1,656 Kb |
Svg sky | Omodev | 7,070 Kb |
CSS Gem Badge | Orchard | 3,335 Kb |
A Pen by Jess | Jessamyne | 5,100 Kb |
A Pen by Mike Otis | Mikeotis | 3,185 Kb |
Avero - Collectieve LVVP Arbeidsongeschiktheidsverzekering - CSS - som | Frederiquebonink | 12,554 Kb |
A Pen by Jay | Jaycode | 3,784 Kb |
Mario | Takaneichinose | 3,902 Kb |
Yuliya v krylova | Rafszul | 37,351 Kb |
Playing with transition timing | Mattgrosswork | 1,993 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!