Last active
November 3, 2015 20:17
-
-
Save xthecapx/b385d86e794bdb148ec9 to your computer and use it in GitHub Desktop.
Swipe events with Javascript
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
$('element').on('wheel', function(e){ | |
var eo = e.originalEvent; | |
if(Math.abs(eo.wheelDeltaY) < 10 && Math.abs(eo.wheelDeltaX) > 2){ | |
e.preventDefault(); | |
if(eo.wheelDeltaX < -100){ | |
// swipe left | |
} | |
if(eo.wheelDeltaX > 100){ | |
// swipe right | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment