iPad/iPhone hover problem causes the user to double click a link

后端 未结 26 1576
太阳男子
太阳男子 2020-11-27 09:18

I have some websites I built times ago, that use jquery mouse events...I just got an ipad and i noticed that all the mouse over events are translated in clicks...so for inst

相关标签:
26条回答
  • 2020-11-27 09:56

    No need to make overcomplicated.

    $('a').on('touchend', function() {
        $(this).click();
    });
    
    0 讨论(0)
  • 2020-11-27 09:58

    To get the links working without breaking touch scrolling, I solved this with jQuery Mobile's "tap" event:

        $('a').not('nav.navbar a').on("tap", function () {
            var link = $(this).attr('href');
            if (typeof link !== 'undefined') {
                window.location = link;
            }
        });
    
    0 讨论(0)
提交回复
热议问题