Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
thednp committed Apr 9, 2019
1 parent 8b84b4b commit c6e5c5f
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 84 deletions.
84 changes: 42 additions & 42 deletions dist/bootstrap-native-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
84 changes: 42 additions & 42 deletions lib/V4/carousel-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit c6e5c5f

Please sign in to comment.