Search code examples
jquery-mobiletouch-event

How to detect if a Tap or Tap Hold occurs while scrolling in jQuery Mobile


Is there any way in jQuery Mobile to detect whether a Tap or Tap Hold is occurring during a scroll event? I keep getting phantom taps because I am scrolling.


Solution

  •     $(document).on("taphold","selector",function(event){
            //do something you want on taphold event
        });
        $(document).on("tap","selector",function(event){
           //do something you want on tap event
        });
    

    selector may be id/class selector of the element you want to handle tap/taphold event.