我有一些我很久以前建立的网站,使用jquery鼠标事件...我刚买了一台ipad,我注意到所有鼠标悬停的事件都被转换成点击...例如,我必须点击两次而不是一次..(第一次悬停,而不是实际的点击)
有没有解决这个问题的方法?也许我应该用jquery命令代替mouseover/out等..
我有一些我很久以前建立的网站,使用jquery鼠标事件...我刚买了一台ipad,我注意到所有鼠标悬停的事件都被转换成点击...例如,我必须点击两次而不是一次..(第一次悬停,而不是实际的点击)
有没有解决这个问题的方法?也许我应该用jquery命令代替mouseover/out等..
Haven't tested this fully but since iOS fires touch events, this could work, assuming you are in a jQuery setting.
$('a').on('click touchend', function(e) {
var el = $(this);
var link = el.attr('href');
window.location = link;
});
The idea is that Mobile WebKit fires a touchend
event at the end of a tap so we listen for that and then redirect the browser as soon as a touchend
event has been fired on a link.