Touch Slider Plugin jQuery swipeSlider - Download Basic Touch Slider Plugin With jQuery - swipeSlider

Download Basic Touch Slider Plugin With jQuery – swipeSlider

Posted on

This time I will share jQuery Plugin and tutorial about Basic Touch Slider Plugin With jQuery – swipeSlider, hope it will help you in programming stack.

Touch Slider Plugin jQuery swipeSlider - Download Basic Touch Slider Plugin With jQuery - swipeSlider
File Size: 5.54 KB
Views Total: 6529
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

swipeSlider is a very basic touch swiper/slider plugin for jQuery that enables the users to slide through images (or any other elements) via mouse drag and touch swipe.

How to use it:

1. The basic HTML markup structure for the slider. You’re allowed to embed any html content to the slides as follow:

01 <div id="slider">
02   <div>
03     <div class="slide-1">
04       Slide 1
05     </div>
06     <div class="slide-2">
07       Slide 2
08     </div>
09     <div class="slide-3">
10       Slide 3
11     </div>
12     ...
13   </div>
14 </div>

2. The basic CSS styles:

01 .ss-slider {
02   height: 100%;
03   overflow: hidden;
04 }
05  
06 .ss-slider > .ss-slides {
07   height: 100%;
08   overflow: hidden;
09   user-select: none;
10   width: 100%;
11 }
12  
13 .ss-slider > .ss-slides > .ss-slide {
14   float: left;
15   height: 100%;
16   overflow: hidden;
17   position: relative;
18 }

3. Link to the latest version of jQuery library and the jQuery swipeSlider plugin.

1 <script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
2 <script src="jquery.swipeSlider.js"></script>

4. Enable the touch slider with default options.

1 var slider = $('#slider').swipeSlider();

5. If you’d like to create custom controls to slide through the slides manually.

1 <a href="#" class="previous">Previous</a>
2 <a href="#" class="next">Next</a>
1 $('.next').on('click', function() {
2   slider.swipeSlider('slideNext');
3 });
4  
5 $('.previous').on('click', function() {
6   slider.swipeSlider('slidePrevious');
7 });

6. All default configuration options and callback functions.

01 var slider = $('#slider').swipeSlider({
02     animationDuration: 300,
03     autoReverse: false,
04     autoTransitionDuration: false,
05     bounce: true,
06     drag: true,
07     infinite: false,
08     onSlideStartCallback: undefined,
09     onSlideCompleteCallback: undefined,
10     onMoveCallback: undefined,
11     onStartCallback: undefined,
12     startIndex: 0
13 });

This awesome jQuery plugin is developed by lukethompson. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net