jquery.event.swipe icon indicating copy to clipboard operation
jquery.event.swipe copied to clipboard

Simplify swipe or scroll math formula with Math.abs

Open taivo opened this issue 10 years ago • 0 comments

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.

taivo avatar Feb 20 '14 08:02 taivo