From c6e5c5f77a4ec377fd619b70082fd215d6f4dbbc Mon Sep 17 00:00:00 2001 From: thednp Date: Tue, 9 Apr 2019 16:59:25 +0300 Subject: [PATCH] --- dist/bootstrap-native-v4.js | 84 ++++++++++++++++++------------------- lib/V4/carousel-native.js | 84 ++++++++++++++++++------------------- 2 files changed, 84 insertions(+), 84 deletions(-) diff --git a/dist/bootstrap-native-v4.js b/dist/bootstrap-native-v4.js index f57515d5..3aec6964 100644 --- a/dist/bootstrap-native-v4.js +++ b/dist/bootstrap-native-v4.js @@ -575,52 +575,52 @@ } self.slideTo( index ); //Do the slide }, - // touch events - toggleTouchEvents = function(toggle){ - toggle( element, touchEvents.move, touchMoveHandler ); - toggle( element, touchEvents.end, touchEndHandler ); - }, - touchDownHandler = function(e) { - if ( isTouch ) { return; } - - startXPosition = parseInt(e.touches[0].pageX); - - if ( element.contains(e[target]) ) { - isTouch = true; - toggleTouchEvents(on); - } - }, - touchMoveHandler = function(e) { - if ( !isTouch ) { e.preventDefault(); return; } - - currentXPosition = parseInt(e.touches[0].pageX); + // touch events + toggleTouchEvents = function(toggle){ + toggle( element, touchEvents.move, touchMoveHandler ); + toggle( element, touchEvents.end, touchEndHandler ); + }, + touchDownHandler = function(e) { + if ( isTouch ) { return; } - //cancel touch if more than one touches detected - if ( e.type === 'touchmove' && e.touches[length] > 1 ) { - e.preventDefault(); + startXPosition = parseInt(e.touches[0].pageX); + + if ( element.contains(e[target]) ) { + isTouch = true; + toggleTouchEvents(on); + } + }, + touchMoveHandler = function(e) { + if ( !isTouch ) { e.preventDefault(); return; } + + currentXPosition = parseInt(e.touches[0].pageX); + + //cancel touch if more than one touches detected + if ( e.type === 'touchmove' && e.touches[length] > 1 ) { + e.preventDefault(); + return false; + } + }, + touchEndHandler = function(e) { + if ( !isTouch || isSliding ) { return } + + endXPosition = currentXPosition || parseInt( e.touches[0].pageX ); + + if ( isTouch ) { + if ( (!element.contains(e[target]) || !element.contains(e.relatedTarget) ) && Math.abs(startXPosition - endXPosition) < 75 ) { return false; - } - }, - touchEndHandler = function(e) { - if ( !isTouch || isSliding ) { return } - - endXPosition = currentXPosition || parseInt( e.touches[0].pageX ); - - if ( isTouch ) { - if ( (!element.contains(e[target]) || !element.contains(e.relatedTarget) ) && Math.abs(startXPosition - endXPosition) < 75 ) { - return false; - } else { - if ( currentXPosition < startXPosition ) { - index++; - } else if ( currentXPosition > startXPosition ) { - index--; - } - isTouch = false; - self.slideTo(index); + } else { + if ( currentXPosition < startXPosition ) { + index++; + } else if ( currentXPosition > startXPosition ) { + index--; } - toggleTouchEvents(off); + isTouch = false; + self.slideTo(index); } - }, + toggleTouchEvents(off); + } + }, // private methods isElementInScrollRange = function () { diff --git a/lib/V4/carousel-native.js b/lib/V4/carousel-native.js index 440e9868..2ba94fc2 100644 --- a/lib/V4/carousel-native.js +++ b/lib/V4/carousel-native.js @@ -101,52 +101,52 @@ var Carousel = function( element, options ) { } self.slideTo( index ); //Do the slide }, - // touch events - toggleTouchEvents = function(toggle){ - toggle( element, touchEvents.move, touchMoveHandler ); - toggle( element, touchEvents.end, touchEndHandler ); - }, - touchDownHandler = function(e) { - if ( isTouch ) { return; } - - startXPosition = parseInt(e.touches[0].pageX); - - if ( element.contains(e[target]) ) { - isTouch = true; - toggleTouchEvents(on); - } - }, - touchMoveHandler = function(e) { - if ( !isTouch ) { e.preventDefault(); return; } - - currentXPosition = parseInt(e.touches[0].pageX); + // touch events + toggleTouchEvents = function(toggle){ + toggle( element, touchEvents.move, touchMoveHandler ); + toggle( element, touchEvents.end, touchEndHandler ); + }, + touchDownHandler = function(e) { + if ( isTouch ) { return; } - //cancel touch if more than one touches detected - if ( e.type === 'touchmove' && e.touches[length] > 1 ) { - e.preventDefault(); + startXPosition = parseInt(e.touches[0].pageX); + + if ( element.contains(e[target]) ) { + isTouch = true; + toggleTouchEvents(on); + } + }, + touchMoveHandler = function(e) { + if ( !isTouch ) { e.preventDefault(); return; } + + currentXPosition = parseInt(e.touches[0].pageX); + + //cancel touch if more than one touches detected + if ( e.type === 'touchmove' && e.touches[length] > 1 ) { + e.preventDefault(); + return false; + } + }, + touchEndHandler = function(e) { + if ( !isTouch || isSliding ) { return } + + endXPosition = currentXPosition || parseInt( e.touches[0].pageX ); + + if ( isTouch ) { + if ( (!element.contains(e[target]) || !element.contains(e.relatedTarget) ) && Math.abs(startXPosition - endXPosition) < 75 ) { return false; - } - }, - touchEndHandler = function(e) { - if ( !isTouch || isSliding ) { return } - - endXPosition = currentXPosition || parseInt( e.touches[0].pageX ); - - if ( isTouch ) { - if ( (!element.contains(e[target]) || !element.contains(e.relatedTarget) ) && Math.abs(startXPosition - endXPosition) < 75 ) { - return false; - } else { - if ( currentXPosition < startXPosition ) { - index++; - } else if ( currentXPosition > startXPosition ) { - index--; - } - isTouch = false; - self.slideTo(index); + } else { + if ( currentXPosition < startXPosition ) { + index++; + } else if ( currentXPosition > startXPosition ) { + index--; } - toggleTouchEvents(off); + isTouch = false; + self.slideTo(index); } - }, + toggleTouchEvents(off); + } + }, // private methods isElementInScrollRange = function () {