Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. var lastY = null;
  2. var currentY = null;
  3.  
  4. jqInboxItem.on("touchstart", function(event) {
  5. lastY = event.originalEvent.touches[0].pageY;
  6. currentY = event.originalEvent.touches[0].pageY;
  7. });
  8.  
  9. jqInboxItem.on("touchmove", function(event) {
  10. currentY = event.originalEvent.touches[0].pageY;
  11. var adjustment = lastY-currentY;
  12.  
  13. // only make an adjustment if cursor position changes vertically by more than 3 pixels
  14. if (Math.abs(lastY-currentY) > 3) {
  15. window.scrollBy(0,adjustment);
  16. lastY = currentY + adjustment;
  17. }
  18.  
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement