禁用jQuery Mobile加载消息和AJAX。

3

我已经连接了常规的jQuery库,并在之后连接了jQuery移动文件(jquery.mobile-1.2.0.min.js)。

一旦我连接了jQuery移动并刷新页面,我就会看到加载屏幕。

我尝试使用以下方法禁用它:

$(document).on("mobileinit", function(){
    $.mobile.ajaxEnabled=false;
    $.mobile.loadingMessage = false;
});

除了尝试不同的初始化函数:

$(document).bind('pageinit'){

但是两者都没有起作用。我仍然只能看到加载消息或完全空白的屏幕。
我真正需要的功能只是滑动事件。
提前致谢。
2个回答

4

Mobileinit必须在引用jQM js文件之前使用,如下所示:

<head>
    <title>jQM Complex Demo</title>
    <meta name="viewport" content="width=device-width"/>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script>
    $(document).on("mobileinit", function(){
        $.mobile.ajaxEnabled=false;
        $.mobile.loadingMessage = false;
    });            
    </script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>    
</head>

如果在脚本加载后执行它,它将不起作用。

只是想说一下.. jquery.js cdn 没有 src,需要在 mobileinit 之前引入,但无论如何都没有解决问题,可能已经过时了... - EnglishAdam
在初始化jquery-mobile js之后,有没有任何方法可以更改$.mobile.选项? - Yusril Maulidan Raji

2

我已经使用了CSS方法。虽然不是最好的,但它可以快速有效地工作。

<style>
.ui-loader 
{
  display: none !important;
}
</style>

这个问题已经有答案了:jQuery Mobile 加载提示信息


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接