Man*_*era 2 jquery events jquery-mobile
这是一个令我疯狂的新手问题.据jQuery Mobile的网站,我已经包括jQuery的和jQuery Mobile的进入head的HTML.
然后,当我为任何事件分配监听器时,它正在运行两次.例:
<!doctype html>
<html>
<head>
<meta http-equiv="imagetoolbar" content="false" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<style>
.slide {width:400px; height:400px; padding:40px; border:1px solid black;}
</style>
<link href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
</head>
<body>
<div class="slide">
<h1>1</h1>
</div>
<script type="text/javascript">
$(function() {
$('.slide').tap(function() {
alert('tapped!');
});
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
然后,如果我点击(或在桌面浏览器中单击)滑动div,则会显示两个警报.如果我评论包括jQuery mobile在内的这一行,它只运行一次.
这里有什么路线?
| 归档时间: |
|
| 查看次数: |
1429 次 |
| 最近记录: |