1

Hi I am using touchstart and touchend to detect scroll on mobile browser.

//Detect Scroll on Mobile//
var ts;
$(document).bind('touchstart', function (e){
   ts = e.originalEvent.touches[0].clientY;
});

$(document).bind('touchend', function (e){
  //e.preventDefault();
   var te = e.originalEvent.changedTouches[0].clientY;
   if(ts > te+5){
      next_slide();
   }else if(ts < te-5){
      e.preventDefault();
      prev_slide();
   }
});

The scroll is working perfectly but none of the links are working when I click them. I believe, this is because, I am capturing touchstart event and it may not be firing click event.

Not sure how to keep my scroll function as is without affecting other links.

By the way, it is working perfectly when I inspect it on desktop chrome. Maybe due to mouseclick event.

0 Answers0