This article illustrates the method of sliding two times in the jquery implementation album. Share to everyone for your reference. The implementation methods are as follows:
var t1=null; Defined as global variable
$ (' body '). On (' Touchstart ', ' #gallerySlider img ', function (e) {
var touch = e.originalevent,
StartX = Touch.changedtouches[0].pagex;
if (T1 = = null) {
T1 = new Date (). GetTime ();
} else{
var t2 = new Date (). GetTime ();
if (T2-t1 <) {
T1 = t2;
return;
} else{
t1 = t2
}
}
Slider.on (' Touchmove ', function (e) {
event.stoppropagation ();
Touch = E.originalevent.touches[0] | |
E.originalevent.changedtouches[0];
if (Touch.pagex-startx >) {
slider.off (' Touchmove ');
Showprevious ();
}
else if (Touch.pagex-startx < -10) {
slider.off (' Touchmove ');
Shownext ();
}
);
return false;
}). On (' Touchend ', function () {
slider.off (' Touchmove ');
});
When the fingers slide start record time, at the end of the record time, if two times apart very close, it ends.
I hope this article will help you with your jquery programming.