Document.ready for the target page not getting invoked using

Document.ready for the target page not getting invoked using jquery mobile transistion

本文关键字:not getting invoked using page target ready for the Document      更新时间:2023-09-26

我正在使用jquery mobile 1.3.1开发一个iphone移动应用程序,虽然有一个从a到B的页面转换,但加载函数ie$(document).ready上的页面B不会被调用

而如果我使用window.location.href从A导航到B,则调用该函数时不会出现任何问题。

我必须为我的应用程序使用页面转换,任何关于如何解决此问题的建议都将不胜感激

$('#page_id').on('pageshow', function(event) { 
//Your script logic
});

在jquery mobile中,不建议使用document.ready,因为它在执行时只加载页面div。(<div data-role="page" id="page_id">)在这里我们可以使用page.on函数。

注意:即使我们使用的是最新版本的jquery-mobile,jquery-moobile也不能顺利地进行页面转换。暂时我们可以关闭它们(page-transition="none"),直到jquery mobile下一版本发布。如果转换与正在执行的脚本一起正常工作,那么我不建议关闭它们。

查看jQuery Mobile常见问题解答:

http://view.jquerymobile.com/1.3.1/dist/demos/faq/dom-ready-not-working.html