スワイプジェスチャー対応のギャラリーがあります。左右にスワイプすることで、ユーザーはギャラリーをナビゲートします。スライドする div の位置を制限して、トラックから外れないようにする必要があります。つまり、ページに到着したら、明らかにすべての画像が右側にあるため、ユーザーが左に (空白に) スワイプしたくありません。 .
「より大きい」を使おうとしましたが、うまくいきません。
var theWidth = $(window).width();
function processingRoutine() {
var swipedElement = document.getElementById(triggerElementID);
if ( swipeDirection == 'left' ) {
$(".frame").animate({marginLeft: '-='+theWidth});
} else if ( swipeDirection == 'right' ) {
$(".frame").animate({marginLeft: '+='+theWidth});
if ( parseInt($(".frame").css("margin-left")) > 1 ) {
$(".frame").animate({marginLeft: "0px"});
}
}
}
ここでソース全体を表示できます: http://joinersart.co.uk/mtest