このMeteorクライアントイベントは、クラスswipe
で正常に動作する要素をスワイプします。私が抱えている問題は、マウスの左ボタンがまだ押されていて、同じクラスで別の要素 "un unentionally"に移動している間です.2番目の要素はmousemoveにも反応します。mousemoveを1つの要素に限定してください
このコードは、画面の右側に<p>
要素をスワイプする独自のスワイプコードをローリングする際に使用するため、一度に1つの要素に固執するにはmousemoveが必要です。すべての要素が同じクラスです。どのようにしてこの問題を解決できますか?おかげ
Template.swipe.events({
'mousemove .swipe': function (event) {
let moveBy = utility.swipeRight(event.clientX);
if (!moveBy) return;
$(event.target).offset({left: moveBy});
}
});
<template name="swipe">
{{#each items}}
<p class="whole swipe" data-id={{this.index}}>{{{value}}}</p>
{{/each}}
</template>