0

I use the following script to prevent the first tap on a link:

$(document).ready(function () {
    $('#container a').bind("touchstart",function(e){
        var $link_id = $(this).attr('id');
        if ($(this).parent().parent().data('clicked') == $link_id) {
            return true;
        } else {
            e.preventDefault();
        }
    });
});

Because these links [#container a] are covering the whole screen I am not able to scroll on touch devices.

Is there a way to keep the scrolling behavior working if the user scrolls (touchmove / swipe / drag / …)?

Maybe there is another way / script to get the effect I want without disabling scrolling…?

António Almeida
  • 9,620
  • 8
  • 59
  • 66

1 Answers1

1

I found another solution to this problem by using quo.js this library will handle tap event without effecting on scrolling functionality the code will be like this

$(document).ready(function () {
 $$('#container a').tap(function(){
     //your function here
 });
});
Tareq Salah
  • 3,720
  • 4
  • 34
  • 48