jquery mobile swipeleft怎么会执行两次 ,大虾们帮帮忙啊!
代码如下<!DOCTYPEhtml><html><metacontent="text/html;charset=utf-8"http-equiv="Content-Typ...
代码如下
<!DOCTYPE html>
<html>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta charset="utf-8" />
<title>移动swipeleft向左滑一次执行两次事件</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript">
$(function(){
$("#box").swipeleft(function(e){
e.preventDefault();
alert("box");
});
$("#con").swipeleft(function(e){
alert("con");
e.stopPropagation();
});
});
</script>
<head>
</head>
<body>
<div data-role="page">
<div data-role="content">
<div style="width:100%;height:200px;background:#ccc;" id="box">
<div style="margin:10px auto;width:50%;height:100px;background:red;" id="con">dsf</div>
</div>
</div>
</div>
</body>
</html>
#con 这个id向左触摸滑动一次,会触发两次事件 展开
<!DOCTYPE html>
<html>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta charset="utf-8" />
<title>移动swipeleft向左滑一次执行两次事件</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript">
$(function(){
$("#box").swipeleft(function(e){
e.preventDefault();
alert("box");
});
$("#con").swipeleft(function(e){
alert("con");
e.stopPropagation();
});
});
</script>
<head>
</head>
<body>
<div data-role="page">
<div data-role="content">
<div style="width:100%;height:200px;background:#ccc;" id="box">
<div style="margin:10px auto;width:50%;height:100px;background:red;" id="con">dsf</div>
</div>
</div>
</div>
</body>
</html>
#con 这个id向左触摸滑动一次,会触发两次事件 展开
2个回答
展开全部
$(function(){
$("#box").swipeleft(function(e){
e.preventDefault();
alert("box");
return false;
});
$("#con").swipeleft(function(e){
alert("con");
e.stopPropagation();
return false;
});
});
$("#box").swipeleft(function(e){
e.preventDefault();
alert("box");
return false;
});
$("#con").swipeleft(function(e){
alert("con");
e.stopPropagation();
return false;
});
});
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询