Skip to content

Commit

Permalink
fixed touch default prevention, and added new touch settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Wanderski committed Feb 27, 2013
1 parent 7034f73 commit 70b2937
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
24 changes: 19 additions & 5 deletions jquery.bxslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@
tickerHover: false,
adaptiveHeight: false,
adaptiveHeightSpeed: 500,
touchEnabled: true,
swipeThreshold: 50,
video: false,
useCSS: true,

// TOUCH
touchEnabled: true,
swipeThreshold: 50,
oneToOneTouch: true,
preventDefaultSwipeX: true,
preventDefaultSwipeY: false,

// PAGER
pager: true,
Expand Down Expand Up @@ -904,9 +909,18 @@
* - DOM event object
*/
var onTouchMove = function(e){
e.preventDefault();
if(slider.settings.mode != 'fade'){
var orig = e.originalEvent;
var orig = e.originalEvent;
// if scrolling on y axis, do not prevent default
var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x);
var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y);
// x axis swipe
if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){
e.preventDefault();
// y axis swipe
}else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){
e.preventDefault();
}
if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){
var value = 0;
// if horizontal, drag along x axis
if(slider.settings.mode == 'horizontal'){
Expand Down
Loading

0 comments on commit 70b2937

Please sign in to comment.