是否有类似 jQuery Mobile 页面生命周期的东西?比如在初始化、显示、隐藏/返回或任何事件时触发的事件?!
提前致谢!
最佳答案
介绍
在这里找到的所有信息也可以在我的博客中找到 ARTICLE ,您还会找到工作示例。
在页面转换期间:
事件 pagecreate
Best event if you want to dynamically add page content and let jQuery Mobile style yout new content. Don't use it in case of ajax call, pagebefore show should be used then but all dynamically added content them must be manually enhanced.
事件 pageinit
It will only trigger once per page load, any return to the page will not trigger it again, unless page is manually refreshed
Best event for the page manipulation
事件 pageremove
事件 pagehide
事件 pageshow
Only event where other graphic jQuery/javascript can be initialized and used, like graph tools or carousels
其余的:
Will always trigger twice so skip it
事件 pagechange
Will always trigger twice so skip it
如果您想了解有关此主题的更多信息以及页面事件的整体工作原理,请查看我的其他 ARTICLE 强>。或者找 HERE 强>。只需搜索名为 Page events transition order 的章节即可。但也可以随时随地阅读所有内容。
官方文档:http://jquerymobile.com/demos/1.2.0/docs/api/events.html
关于javascript - jQuery Mobile -> 页面生命周期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15232532/