这是我的HTML5上的内容
<div class="google-play">
<a href="http://example.com" role="button">
<img src="img/google-play-btn.png"/>
</a>
</div>在chrome,FF,android上运行良好,但似乎不能在iPad上运行。
发布于 2013-11-26 06:03:08
在所有锚标签上通过jQuery使用touchend事件。例如:
$(function () {
$('a').on('click touchend', function() {
var link = $(this).attr('href');
window.open(link,'_blank'); // opens in new window as requested
return false; // prevent anchor click
});
});如果您只想让上面的设备和iPad具有特定的功能,请检查“iPhone”是不是iPad、iPhone等。如下所示:
$(function () {
IS_IPAD = navigator.userAgent.match(/iPad/i) != null;
IS_IPHONE = (navigator.userAgent.match(/iPhone/i) != null) || (navigator.userAgent.match(/iPod/i) != null);
if (IS_IPAD || IS_IPHONE) {
$('a').on('click touchend', function() {
var link = $(this).attr('href');
window.open(link,'_blank'); // opens in new window as requested
return false; // prevent anchor click
});
}
});https://stackoverflow.com/questions/20204255
复制相似问题