[英]multiple swap in same page not working
i have on div which have left swipe 我在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>
now my problem exactly is : 现在我的问题正好是:
swipe on iframe-content is working fine but i have given another swipe on another-swipe
在iframe内容上滑动可正常使用,但我在另一滑动上
another-swipe
$(".another-swipe").swipeleft(function(e) {
alert("test2")
});
but its giving the previous alert not alert("test2");
但是它给先前的警报不是
alert("test2");
.... ....
use class instead of ID with another-swipe. 使用class而不是ID进行另一次刷卡。
you can use e.stopPropagation(); 您可以使用e.stopPropagation(); to stop the upper call
停止高层电话
See fiddle here (with click instead of swipe) : http://jsfiddle.net/26w2q/ 请在此处查看小提琴(单击而不是滑动): http : //jsfiddle.net/26w2q/
HTML 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 JQUERY
$(".another-swipe").swipeleft(function(e) {
e.stopPropagation();
alert("test2")
});
$(".iframe-content").swipeleft(function(e) {
alert ("test 1");
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.