4
一些jQuery Mobile的触摸事件我有以下的代码,它似乎很清楚,jQuery是工作,但一些jQuery Mobile的事件不烧都:没有发射
<!DOCTYPE html>
<html>
<head>
<title>JQuery Mobile Test</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile.custom.complete.min.js"></script>
<link rel="stylesheet" href="css/jquery.mobile.custom.complete.theme.min.css"/>
<link rel="stylesheet" href="css/jquery.mobile.custom.complete.structure.min.css"/>
<script>
$(function(){
$(document).on("touchstart", function(e){
$('#touchstart').html("touchstart");
});
$(document).on("touchend", function(e){
$('#touchend').html("touchend");
});
$(document).on("touchmove", function(e){
$('#touchmove').html("touchmove");
});
$(document).on("touchcancel", function(e){
$('#touchcancel').html("touchcancel");
});
$(document).on("tap", function(e){
$('#tap').html("tap");
});
$(document).on("taphold", function(e){
$('#taphold').html("taphold");
});
$(document).on("swipe", function(e){
$('#swipe').html("swipe");
});
});
</script>
<style>
</style>
</head>
<body>
<div id="touchstart">-</div>
<div id="touchend">-</div>
<div id="touchmove">-</div>
<div id="touchcancel">-</div>
<div id="tap">-</div>
<div id="taphold">-</div>
<div id="swipe">-</div>
</body>
</html>
我想出来的Android上的Chrome。在上述事件中,这些不起作用:tap
,taphold
和swipe
。我有三重检查文件的URL。
上面的JQuery版本:JQuery:压缩,生产3.1.1,和最新的JQuery Mobile:1.4.5,自定义与所有选项,缩小。
烦人它的工作原理预期,当我与(随机)更早的版本替换链接和脚本标记,的jQuery主持:
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
它当我用不工作最新的JQuery托管版本:
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
但我需要自己托管这些文件,我希望拥有最新版本。我究竟做错了什么? API有差异吗?或者它是一个JQuery的错误?
它不使用jQuery V3工作。使用旧版本的jQuery。另外,我不推荐使用jQM的自定义版本;创建自己的触摸事件。 – Omar