4_15_2019 update
This commit is contained in:
58
public/assets/js/jquery.bcSwipe.min.js
vendored
Normal file
58
public/assets/js/jquery.bcSwipe.min.js
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
/**
|
||||
* Bootstrap Carousel Swipe v1.1
|
||||
*
|
||||
* jQuery plugin to enable swipe gestures on Bootstrap 3 carousels.
|
||||
* Examples and documentation: https://github.com/maaaaark/bcSwipe
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.bcSwipe = function(settings) {
|
||||
var config = { threshold: 50 };
|
||||
if (settings) {
|
||||
$.extend(config, settings);
|
||||
}
|
||||
|
||||
this.each(function() {
|
||||
var stillMoving = false;
|
||||
var start;
|
||||
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
this.addEventListener('touchstart', onTouchStart, false);
|
||||
}
|
||||
|
||||
function onTouchStart(e) {
|
||||
if (e.touches.length == 1) {
|
||||
start = e.touches[0].pageX;
|
||||
stillMoving = true;
|
||||
this.addEventListener('touchmove', onTouchMove, false);
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchMove(e) {
|
||||
if (stillMoving) {
|
||||
var x = e.touches[0].pageX;
|
||||
var difference = start - x;
|
||||
if (Math.abs(difference) >= config.threshold) {
|
||||
cancelTouch();
|
||||
if (difference > 0) {
|
||||
$(this).carousel('next');
|
||||
}
|
||||
else {
|
||||
$(this).carousel('prev');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cancelTouch() {
|
||||
this.removeEventListener('touchmove', onTouchMove);
|
||||
start = null;
|
||||
stillMoving = false;
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user