これは私が私のHTML5アンカータグ(IOS)
<div class="google-play">
<a href="http://example.com" role="button">
<img src="img/google-play-btn.png"/>
</a>
</div>
に持っているもので、クロム、FF上で正常に動作し、アンドロイドが、動作していないようiPadで。
これは私が私のHTML5アンカータグ(IOS)
<div class="google-play">
<a href="http://example.com" role="button">
<img src="img/google-play-btn.png"/>
</a>
</div>
に持っているもので、クロム、FF上で正常に動作し、アンドロイドが、動作していないようiPadで。
すべてのアンカータグに対してtouchend
イベントをjQuery経由で使用します。
$(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
});
});
あなただけのiPhoneやiPad上の特定の機能を作りたい場合は、そのようなど、「デバイス」は、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
});
}
});
をとあなたが働いていないことは、正確に何を意味するのでしょ –
をクリックすると何も起こりません。 – Monica
Safariでhtmlページを開いたところで、クリックしてリンクが期待通りに処理されました。 http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_a_href_anchorと同じです。あなたは何が問題なのかを正確に説明しなければなりません。 –