多数の div で動的に満たされる空のコンテナー div があります。
<div class="tile-container">
<div class="tile tile-position-1-1">3</div>
<div class="tile tile-position-1-2">2</div>
<div class="tile tile-position-1-3">1</div>
</div>
全方向のスワイプを検出するために Hammer jQuery プラグインを使用しています。これはデスクトップではマウス スワイプで機能しますが、モバイル デバイスでテストするとスワイプが認識されません。
モバイルデバイスで動作しない理由はありますか?
var hammertime = $('.tile-container').hammer({prevent_default:true, domEvents:true});
$('.tile-container').data("hammer").get('swipe').set({ direction: Hammer.DIRECTION_ALL, threshold: 0 });
hammertime.on("swipeleft swiperight swipeup swipedown", ".tile", function(ev) {
PreventGhostClick('.tile-container');
ev.originalEvent.gesture.srcEvent.preventDefault();
var classIndex = $.grep($(this).attr('class').split(' '), function(v, i) {
return v.indexOf("tile-position") === 0;
}).join();
alert(ev.type + " " + classIndex);
});