我在div上留下了滑动
$(".iframe-content").swipeleft(function(e) {
alert ("test 1");
});
<div class="iframe-content">
<div class="noswipe">no swipe</div>
<div class="noswipe">no swipe</div>
<div class="noswipe">no swipe</div>
<div class="noswipe">no swipe</div>
<div id="another-swipe">swipe here</div>
<div class="noswipe">no swipe</div>
<div class="noswipe">no swipe</div><div class="noswipe">no swipe</div>
</div>
现在我的问题恰恰是:
在 iframe-content 上滑动工作正常,但我在another-swipe
上再次滑动
$(".another-swipe").swipeleft(function(e) {
alert("test2")
});
但它提供的上一个警告不是alert("test2");
....
答案 0 :(得分:1)
使用class而不是ID与另一次刷卡。
你可以使用e.stopPropagation();停止上呼叫
请点击此处(点击而不是滑动): http://jsfiddle.net/26w2q/
HTML
<div class="iframe-content">
<div class="noswipe">no swipe</div>
<div class="noswipe">no swipe</div>
<div class="noswipe">no swipe</div>
<div class="noswipe">no swipe</div>
<div class="another-swipe">swipe here</div> <<< USE class instead of id
<div class="noswipe">no swipe</div>
<div class="noswipe">no swipe</div>
<div class="noswipe">no swipe</div>
</div>
JQUERY
$(".another-swipe").swipeleft(function(e) {
e.stopPropagation();
alert("test2")
});
$(".iframe-content").swipeleft(function(e) {
alert ("test 1");
});