-
-
Save r37r0m0d3l/6287012 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var point, pointStartX, pointStartY, deltaX, deltaY; | |
var scroller = new iScroll('scrollerId', { | |
vScroll: false, | |
vScrollbar: false, | |
hScrollbar: false, | |
snap: 'li', | |
momentum: false, | |
onBeforeScrollStart: function(e) { | |
point = e.touches[0]; | |
pointStartX = point.pageX; | |
pointStartY = point.pageY; | |
null; | |
}, | |
onBeforeScrollMove: function(e) { | |
deltaX = Math.abs(point.pageX - pointStartX); | |
deltaY = Math.abs(point.pageY - pointStartY); | |
if (deltaX >= deltaY) { | |
e.preventDefault(); | |
} else { | |
null; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment