HTML List Based Carousel Plugin - jQuery Slider.js
| File Size: | 3.97 KB |
|---|---|
| Views Total: | 10306 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
A simple, lightweight, semantic jQuery slider plugin for generating a basic carousel/slider from a normal HTML unordered list. Features auto play, infinite loop, and navigation/pagination controls.
How to use it:
1. Create a list of slides together with the navigation controls on the web page.
<div id="slider">
<a href="#" class="next">></a>
<a href="#" class="prev"><</a>
<ul>
<li>SLIDE 1</li>
<li>SLIDE 2</li>
<li>SLIDE 3</li>
<li>SLIDE 4</li>
<li>SLIDE 5</li>
...
</ul>
</div>
2. Link to jQuery JavaScript library and the jQuery Slider.js script.
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT"
crossorigin="anonymous">
</script>
<script src="slider.js"></script>
3. The example CSS for the carousel/slider.
#slider {
position: relative;
overflow: hidden;
width: 400px;
height: 300px;
}
#slider ul {
position: relative;
margin: 0;
padding: 0;
height: 200px;
list-style: none;
left: 0px;
}
#slider ul li {
position: relative;
display: block;
float: left;
margin: 0;
padding: 0;
width: 400px;
height: 300px;
}
a.prev, a.next {
position: absolute;
top: 40%;
z-index: 999;
display: block;
padding: 4% 3%;
width: auto;
height: auto;
background: #2a2a2a;
color: #fff;
text-decoration: none;
font-weight: 600;
font-size: 18px;
opacity: 0.8;
cursor: pointer;
}
a.prev:hover, a.next:hover {
opacity: 1;
-webkit-transition: all 0.2s ease;
}
a.prev {
border-radius: 0 2px 2px 0;
}
a.next {
right: 0;
border-radius: 2px 0 0 2px;
}
4. Initialize the slider/carousel and done.
$("#slider").sliderNd();
5. Enable the autoplay.
$("#slider").sliderNd({
autoplay: true,
playTime: 5000
});
6. Disable the infinite loop.
$("#slider").sliderNd({
type: 'hiddenAnchor'
});
7. Enable navigation controls.
$("#slider").sliderNd({
navigation: true,
next: 'next',
prev: 'prev'
});
8. Set the delay between each slide.
$("#slider").sliderNd({
delay: 200
});
9. Set the height & width of the carousel/slider.
$("#slider").sliderNd({
width: 700,
height: 300
});
This awesome jQuery plugin is developed by Dead-Archie. For more Advanced Usages, please check the demo page or visit the official website.










