简体   繁体   English

使用jQuery mobile,要完全禁用导航

[英]Using jQuery mobile, want to disable navigation completely

We would like to use jquery mobile for all aspects of our site, but disable the page transitions completely, as we need to handle navigation on our own. 我们希望在网站的所有方面都使用jquery mobile,但由于需要自行处理导航,因此完全禁用了页面转换。 So far, we have added the following to no avail: 到目前为止,我们已经添加了以下内容:

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

Our main problem is, all the "href" attribute values are being replaced with a hash tag (just a single #) and are losing our original href values, causing our navigation to obviously fail. 我们的主要问题是,所有“ href”属性值都被一个哈希标记(只是一个#)取代,并且丢失了原始的href值,从而导致导航显然失败。

How can I prevent jQuery mobile from replacing my href attributes entirely? 如何防止jQuery mobile完全替换我的href属性? Thanks. 谢谢。

<script src="jquery-1.7.1.js"></script>
<script>
$(document).on("mobileinit", function () {
    $.mobile.ajaxEnabled = false;
});
</script>
<script src="jquery-mobile-1.1.0.js"></script>

I'm not sure where you got the ajaxLinksEnabled and the ajaxFormsEnabled options but they aren't listed on the "Configuring Default" documentation page: http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html . 我不确定在何处获得ajaxLinksEnabledajaxFormsEnabled选项,但未在“配置默认”文档页面上列出: http : //jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html Try using the above option, ajaxEnabled . 尝试使用上述选项ajaxEnabled

Thanks! 谢谢! It turned out that I needed to set linkBindingEnabled to be false. 原来,我需要将linkBindingEnabled设置为false。 Here is my script: 这是我的脚本:

<script type="text/javascript">
            $(document).on("mobileinit", function () {
                // Reference: http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html
                $.extend($.mobile, {
                    linkBindingEnabled: false,
                    ajaxEnabled: false
                });
            });
        </script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM