如何在页面加载之前在jQuery Mobile中禁用Ajax?

如何在页面加载之前在jQuery Mobile中禁用Ajax?,第1张

如何在页面加载之前在jQuery Mobile中禁用Ajax?

签出与

mobileinit
事件绑定的文档:http
:
//jquerymobile.com/demos/1.0/docs/api/globalconfig.html

具体来说:

由于mobileinit事件是在执行后立即触发的,因此您需要在加载jQuery Mobile之前绑定事件处理程序。

这是绑定到

mobileinit
事件的正确格式:

<link rel="stylesheet" href="http://pre.jquery.com/mobile/1.0rc3/jquery.mobile-1.0rc3.min.css" /><script src="http://pre.jquery.com/jquery-1.6.4.min.js"></script><script type="text/javascript">$(document).bind("mobileinit", function () {    $.mobile.ajaxEnabled = false;});</script><script src="http://pre.jquery.com/mobile/1.0rc3/jquery.mobile-1.0rc3.min.js"></script>

首先是jQuery Core(因此

.bind()
将可用),然后是
mobileinit
事件处理程序,然后是jQuery Mobile
js文件(这是最后一个,因此
mobileinit
将在触发事件之前设置事件处理程序)。

您可以

mobileinit
通过
alert
在函数中放入来测试当前事件处理程序是否未触发。



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5029830.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-15
下一篇 2022-11-15

发表评论

登录后才能评论

评论列表(0条)

保存