在 jQueryMobile 页面上初始化 JS 脚本
我正在使用 jQueryMobile 1.0 Beta 2 开发一个单页应用程序,并在 iOS 4.3.5 Mobile Safari 上进行测试。
正如我们在这里看到的: http://jquerymobile.com/test/docs/api/events.html
jquery mobile api 对于使用 ajax 调用初始化脚本的新方法非常具体。我正在使用 jquery mobile api 中的 pageCreate() 事件来初始化我的脚本:
$('.ui-page').live('pagecreate',function(event){
//my js init codes
});
但不知何故,它不是那么有效,并且我在未初始化的关键视图之一上遇到了麻烦。
任何帮助表示赞赏。
谢谢。
I am working on a single-page app using jQueryMobile 1.0 Beta 2 and testing on iOS 4.3.5 Mobile Safari.
As we can see here:
http://jquerymobile.com/test/docs/api/events.html
The jquery mobile api is very specific on the new way to initialize scripts with the ajax calls. I am using the pageCreate() event from the jquery mobile api to initialize my scripts:
$('.ui-page').live('pagecreate',function(event){
//my js init codes
});
But somehow, it is not so effective and I am having trouble on one of my key views which doesn't initialize.
Any help is appreciated.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 pageshow 事件:
这在我的应用程序中对我有用。希望它对你有用。
Try using the pageshow event:
This is working for me in my app. Hope it works for you.