Responsive Any Content Carousel Plugin For jQuery - rl-carousel
File Size: | 4.71 KB |
---|---|
Views Total: | 4396 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
rl-carousel is a lightweight, fully responsive and multi-slide jQuery carousel which will auto collapse into a single-slide content slider on small screens.
How to use it:
1. The plugin requires Font Awesome for the navigation icons (OPTIONAL).
<link rel="stylesheet" href="font-awesome.css">
2. Add your own slides containing any html elements to the carousel.
<div class="carousel-container"> <div class="carousel"> <div class="roll"> <div class="slides"> <img src="1.jpg" alt="slides img 1"> <p>Image Description</p> </div> <div class="slides"> <img src="2.jpg" alt="slides img 2"> <p>Image Description</p> </div> <div class="slides"> <img src="3.jpg" alt="slides img 3"> <p>Image Description</p> </div> ... </div> <div class="sections"> </div> <button class="navigation" id="nav-left"> <i class="fa fa-angle-left" aria-hidden="true"></i> </button> <button class="navigation" id="nav-right"> <i class="fa fa-angle-right" aria-hidden="true"></i> </button> </div> </div>
3. Include both jQuery library and the rl-carousel.js
at the bottom of the webpage.
<script src="jquery.min.js"></script> <script src="rl-carousel.js" async defer></script>
4. Let's start to style the carousel in the CSS.
.carousel-container { display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; } .carousel { position: relative; overflow: hidden; width: 930px; } .roll { position: relative; white-space: nowrap; font-size: 0; left: 0px; } .slides { width: 300px; height: 350px; background-color: #FFF; -webkit-box-shadow: 5px 5px 5px 1px rgba(0,0,0,0.5); -moz-box-shadow: 5px 5px 5px 1px rgba(0,0,0,0.5); box-shadow: 5px 5px 5px 1px rgba(0,0,0,0.5); text-align: center; margin: 0 10px 15px 0; display: inline-block; font-size: 18px; } .slides img { margin-top: 10px; width: 280px; height: 200px; } .slides p { margin: 10px; font-family: 'Source Sans Pro', sans-serif; font-weight: 200; text-align: left; white-space: normal; } .sections { text-align: center; color: #b4fdc0; font-size: 12px; } .sections i { margin: 0 2px; cursor: pointer; } .navigation { position: absolute; border: none; padding: 0; background-color: rgba(35,35,35,0.8); height: 34px; width: 34px; color: #FFF; font-size: 20px; text-align: center; top: 176px; z-index: 10; } .navigation:visited { text-decoration: none; } .navigation-hover { height: 50px; width: 50px; top: 168px; } .navigation:active { text-decoration: none; } .navigation:focus { outline: none; } .navigation:first-of-type { left: 0px; } .navigation:last-of-type { right: 10px; } @media screen and (max-width: 950px) { .carousel { position: relative; overflow: hidden; width: 620px; } } @media screen and (max-width: 655px) { .carousel { position: relative; overflow: hidden; width: 310px; } }
This awesome jQuery plugin is developed by rlisboars. For more Advanced Usages, please check the demo page or visit the official website.