プラグインを見るhttp://stereobit.github.io/dragend/demos/simple/スワイプは変換値を変更することで起こります。プラグインのデモページのサンプルコードからhtmlの一部を取り出すとします。
<div id="swipeWrapper" style="overflow: hidden; width: 2500px; box-sizing: content-box; backface-visibility: hidden; perspective: 1000px; margin: 0px; padding: 0px; transform: translateX(-500px);"></div>
イラストレーションの目的でラッピングdivのIDを追加して、それをswipeWrapperと呼びましょう。 あなたのjavascriptファイルにあります。 divから変換値を読み込みます。
var prevTransformValue = 0;//Initialize the value before you swipe;
var swipeWrapper = document.getElementById('swipeWrapper');
var transformValue = swipeWrapper.style.transform;
var currentTransformValue = transformValue.replace(/[^\d|^\-]/g,'');
例のtransformValueは "translateX(-500px)"です。 currentTransformValue = "-500";
ここで、prevTransformValue> currentTransformValueと比較すると、スワイプの方向が左になり、prevTransformValue <のcurrentTransformValueswipeのスワイプの方向が右になります。
注:prevTransformValue = currentTransformValueを設定することを忘れないでください。あなたが方向の価値を得た後。この例は、水平方向にスワイプしている場合です。
よろしくお願い致します。私はJQueryを使って、誰もが興味を持っていました: 'transformBefore = parseInt($( '#swipeWrapper')。 \t ' – AlexioVay