Use of swipe. js, use of swipe. js
Introduction
Github: https://github.com/thebird/swipe
A js component for image scrolling. It supports gesture touch screen.
Usage
<div id='slider' class='swipe'> <div class='swipe-wrap'> <div></div> <div></div> <div></div> </div></div>
.swipe { overflow: hidden; visibility: hidden; position: relative;}.swipe-wrap { overflow: hidden; position: relative;}.swipe-wrap > div { float:left; width:100%; position: relative;}
This is a nested container,
Write js Code:
window.mySwipe = Swipe(document.getElementById('slider'));
Attribute Introduction
- StartSlide Integer (default: 0)-start div
- Speed Integer (default: 300)-Sliding speed
- Auto Integer-automatically scroll after several milliseconds (two scrolling intervals)
- Continuous Boolean (default: true)-Infinite Loop
- DisableScroll Boolean (default: false)-Disable gesture sliding
- StopPropagation Boolean (default: false)-stop event propagation does not understand its role for the moment
- Callback Function-callback event during switchover
- TransitionEnd Function-slide to the last page to execute the event
Method Introduction
- Prev () backward
- Next () Forward
- Current location of getPos ()
- Total number of getNumSlides () screens
- Slide (index, duration) slides to a screen