Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Guided by ezanker's response, I went to the docs to see if there was a way to postpone when the whole page is being created. There is, it is by setting <code>mobile.autoInitializePage</code> to false and then calling <code>initializePage()</code> when needed. That is what my solution below does.</p> <p>This way, there is no arbitrary timeout. The dynamic page is the only one that shows when I click on the reload button.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;JQM latest - issue template&lt;/title&gt; &lt;meta charset="utf-8"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/git/jquery.mobile-git.css"&gt; &lt;script src="http://code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).bind("mobileinit", function () { console.log('mobileinit called'); $.mobile.autoInitializePage = false; }); &lt;/script&gt; &lt;script src="http://code.jquery.com/mobile/git/jquery.mobile-git.js"&gt;&lt;/script&gt; &lt;script&gt;$(document).ready(function() { console.log('document ready'); var newPage = $('&lt;div data-role="page" id="dynamic" data-url="yay"&gt;&lt;div data-role="header"&gt;&lt;h1&gt;Dynamic Page&lt;/h1&gt;&lt;/div&gt;&lt;div class="ui-content"&gt;&lt;ul&gt;&lt;li&gt;This page is dynamically generated.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;'); newPage.appendTo($('body')); $.mobile.initializePage(); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div data-role="page" id="homepage"&gt; &lt;div data-role="header"&gt; &lt;h1&gt;Issue template&lt;/h1&gt; &lt;/div&gt;&lt;!-- /header --&gt; &lt;div class="ui-content"&gt; &lt;ul&gt; &lt;li&gt;We are on the Homepage&lt;/li&gt; &lt;li&gt;Go to &lt;a href="#static"&gt;static&lt;/a&gt;&lt;/li&gt; &lt;li&gt;Go to &lt;a href="#dynamic"&gt;dynamic&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;!-- /content --&gt; &lt;/div&gt;&lt;!-- /page --&gt; &lt;div data-role="page" id="static"&gt; &lt;div data-role="header"&gt; &lt;h1&gt;Static Page&lt;/h1&gt; &lt;/div&gt;&lt;!-- /header --&gt; &lt;div class="ui-content"&gt; &lt;ul&gt; &lt;li&gt;This page is in the index.html.&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;!-- /content --&gt; &lt;/div&gt;&lt;!-- /page --&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload