我们希望在网站的各个方面使用 jquery mobile,但完全禁用页面转换,因为我们需要自己处理导航。到目前为止,我们添加了以下内容但没有效果:
$(document).on("mobileinit", function () {
$.mobile.ajaxLinksEnabled = false;
$.mobile.ajaxFormsEnabled = false;
});
我们的主要问题是,所有“href”属性值都被替换为哈希标签(只是一个#),并且丢失了原始的 href 值,导致我们的导航明显失败。
如何防止 jQuery mobile 完全替换我的 href 属性?谢谢。
最佳答案
<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>
我不确定您从哪里获得 ajaxLinksEnabled
和 ajaxFormsEnabled
选项,但它们未在“配置默认值”文档页面上列出:http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html 。尝试使用上面的选项,ajaxEnabled
。
关于javascript - 使用 jQuery mobile,想要完全禁用导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11250803/