When you navigate to a new page or when a page is loaded in the DOM, the framework initializes the page and makes it visible. This is controlled by the $.mobile.intializePage
property, which has a Boolean value of true
by default. If this is set to false
, the page is not shown. You will have to manually set this back to true
to show the page. This recipe shows you how to do the same.
Copy the full code of this recipe from the code/07/auto-initialize
sources folder. You can launch this code by using the URL: http://localhost:8080/07/auto-initialize/main.html
.
In
main.html
, add the following script before includingjquery.mobile.js
:$(document).bind("mobileinit", function() { $.mobile.autoInitializePage = false; });
Create the main page with the following content:
<div data-role="content"> <a href="#" data-role="button">A button</a> <script> $.mobile.autoInitializePage = true; </script> </div...