I am using the following code to changePage from First.html

$.mobile.changePage("Second.html", { transition: "slide" });

But this is neither calling document.ready on Second.js or pageshow or pagecreate events.

How do I call a method in Second.js after Second.html is loaded?

有帮助吗?

解决方案

I would guess your problem is related to placement of your Second.js file.

When loading intermediate pages, jQuery Mobile will strip whole page and load only BODY content. This is because jQuery Mobile uses AJAX for page handling. Only first (initial) page is fully loaded into the DOM. For other pages it is not necessary to load everything, no point if you already have whole page loaded into the DOM.

Read this article to find more about this problem. You will find several working solution.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top