部分 JQuery 移动触摸事件未触发

Some JQuery Mobile touch events not firing

我有以下代码,JQuery 似乎很清楚,但一些 JQuery 移动事件根本没有触发:

<!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>

我正在 Chrome Android 上试用。在上述事件中,以下事件不起作用:taptapholdswipe。我已经三次检查了文件 URL。

以上 JQuery 的版本:JQuery:压缩版,生产版 3.1.1,以及最新的 JQuery 移动版:1.4.5,带有所有选项的自定义版,缩小版。

恼人的是当我用JQuery托管的(随机)早期版本替换link和脚本标签时,它按预期工作

<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 错误?

要扩展 Omar 上面的评论... jQuery 移动设备目前与最新版本的 jQuery 不兼容。如果您查看 jquerymobile homepage,您会在下载按钮(右上角)下方看到您可以使用的 jQuery 版本。当前对于 jQM v.1.4.5,您需要:

jQuery 1.8 - 1.11 / 2.1