Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify swipe or scroll math formula with Math.abs #19

Open
taivo opened this issue Feb 20, 2014 · 0 comments
Open

Simplify swipe or scroll math formula with Math.abs #19

taivo opened this issue Feb 20, 2014 · 0 comments

Comments

@taivo
Copy link

taivo commented Feb 20, 2014

Hi,
It took me a bit of time to verify the swipe or scroll math in index.html before using it in my code. If I understand the formula correctly, you're basically comparing absolute values to see whether finger movement is more pronounced vertically or horizontally. Replacing that code with if(Math.abs(e.distY) > Math.abs(e.distX)){ e.preventDefault();} would make things easier to intuit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant