Lightweight & Responsive jQuery Slider Plugin - Simple Slideshow
| File Size: | 2.05 MB |
|---|---|
| Views Total: | 23482 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
Simple Slideshow is a small jQuery slider plugin for creating full responsive, touch-friendly and fast content slider/slideshow on your website.
Features:
- Arrows, dot, and swipe (on mobile device)navigation.
- Enlarges the dots navigation on touch devices.
- Full responsive with no dependencies on javascript.
- Easy to use and customizable.
- Infinite looping as a carousel.
How to use it:
1. Markup the html.
<div class="slider slider--disabled">
<button class="slider__button slider__button--previous">
<b class="slider__button__icon">« Previous</b>
</button>
<button class="slider__button slider__button--next">
<b class="slider__button__icon">Next »</b>
</button>
<div class="slider__strip">
<div class="slider__slide slider__slide--1 slider__slide--sticky"></div>
<div class="slider__slide slider__slide--2"></div>
<div class="slider__slide slider__slide--3"></div>
<div class="slider__slide slider__slide--4"></div>
<div class="slider__slide slider__slide--5"></div>
<div class="slider__slide slider__slide--6"></div>
</div>
<div class="slider__markers"></div>
</div>
2. Load the jQuery javascript library and jQuery Simple Slideshow plugin on the page.
<script src="jquery.min.js"></script> <link rel="stylesheet" href="touch-slider.css"> <script src="touch-slider.js"></script>
3. Create and initialize the slideshow.
new TouchSlider({ slider: '.slider', canLoop: true }).init();
4. Add the following styles to your CSS file.
.slider { height: 100%; }
.slider__strip { height: 100%; }
.slider__slide {
overflow: hidden;
background-position: 50% 50%;
background-size: cover;
}
.slider__slide--1 { background-image: url(../img/example1.jpg); }
.slider__slide--2 { background-image: url(../img/example2.jpg); }
.slider__slide--3 { background-image: url(../img/example3.jpg); }
.slider__slide--4 { background-image: url(../img/example4.jpg); }
.slider__slide--5 { background-image: url(../img/example5.jpg); }
.slider__slide--6 { background-image: url(../img/example6.jpg); }
.slider__button, .slider__marker {
margin: 0;
background: none;
border: 0;
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.slider--disabled .slider__button, .slider--disabled .slider__marker { display: none; }
.slider__button__icon {
display: block;
width: 23px;
height: 36px;
background: transparent url(../img/arrow.png) no-repeat 0 -36px;
background: transparent url(../img/arrow.svg) no-repeat 0 -36px;
background-size: 23px 72px;
text-indent: -10000px;
}
.slider__button--next .slider__button__icon {
left: 10px;
background-position: 0 0;
}
.slider__button--next {
padding-right: 7px;
padding-left: 10px;
}
.slider__button::-moz-focus-inner {
margin: -1px;
padding: 0;
}
.advanced .slider__button {
position: absolute;
top: 50%;
display: block;
width: 40px;
height: 36px;
margin-top: -36px;
padding-right: 10px;
padding-left: 7px;
}
.slider__markers {
position: relative;
top: -45px;
height: 15px;
padding: 15px 10px;
text-align: center;
font-size: .8em;
}
.slider--enable-touch .slider__markers {
top: -65px;
padding: 25px 10px;
}
.slider__marker {
display: inline-block;
padding: 0;
width: 10px;
height: 10px;
background: white;
border-radius: 5px;
text-indent: -10000px;
opacity: .4;
}
.slider__marker--sticky {
background-color: #3172dd;
opacity: 1;
}
.slider__marker+.slider__marker { margin-left: 10px; }
.slider--enable-touch .slider__marker {
width: 16px;
height: 16px;
border-radius: 8px;
}
.slider--enable-touch .slider__marker+.slider--enable-touch .slider__marker { margin-left: 15px; }
5. Configurations.
next: '.slider__button--next', previous: '.slider__button--previous', markers: '.slider__markers', numbers: '.slider__numbers', // Classes classStrip: 'slider__strip', classSlide: 'slider__slide', classSlideActive: 'slider__slide--sticky', classMarker: 'slider__marker', classMarkerActive: 'slider__marker--sticky', classButtonDisabled: 'slider__button--disabled', classDisabled: 'slider--disabled', classTouch: 'slider--enable-touch', // How many to step next/prev by step: 1, // Adjust timings delay: 3000, interval: 5000, time: 400, // Custom display type display: 'block', // Allow infinite looping, auto-play or carousel style? canLoop: false, isManual: true, isCarousel: true, // Run callbacks at defined breakpoints breakpoints: [ /*{ range: [0, 767], callback: function() { console.log('Mobile'); } }*/ ]
Change logs:
2016-03-04
- Rename to touch-slider
- API update
2014-11-27
- Only use zero transition time for hash change
2014-05-28
- Only use zero transition time for hash change
2014-03-04
- Don't update touch X/Y if no frame is ready
2014-02-24
- Better specify IE touch actions
2014-02-14
- IE11 unprefixes pointer events
2014-02-04
- Marker element can now be configured
- In case more than one slide is marked "sticky", only use first
2014-01-28
- Remove click to jump to slide, this can be manually added where required
2014-01-19
- Allow isTouch to be set via config (otherwise, auto-detected)
2013-12-05
- Ensure touches also provide callback event params
This awesome jQuery plugin is developed by colinrotherham. For more Advanced Usages, please check the demo page or visit the official website.










