mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
commit
dc230cbb63
1 changed files with 1 additions and 1 deletions
|
|
@ -27,7 +27,7 @@
|
|||
<h2>Scripts & styles in the head</h2>
|
||||
|
||||
<p>When you click a link in jQuery Mobile, the Ajax navigation system uses the link's href to formulate an Ajax request. Although the full page is loaded with Ajax, the framework only pulls in the <em>contents of the page</em>, and ignores anything in the <code>head</code> except for title tag contents.</p>
|
||||
<p> This means that any scripts or styles in the <code>head</code> of the page won't have any affect <em>when the page is loaded via Ajax</em>. The same page will work as expected if you were to load a page directly but both scenarios need to be considered. The reason that the <code>head</code> is ignored for Ajax page content: it's just too complex. The framework would need to compare and reconcile the contents of multiple page <code>head</code> elements as they are loaded into the DOM so we leave this task to the developer.</p>
|
||||
<p> This means that any scripts or styles in the <code>head</code> of the page won't have any effect <em>when the page is loaded via Ajax</em>. The same page will work as expected if you were to load a page directly but both scenarios need to be considered. The reason that the <code>head</code> is ignored for Ajax page content: it's just too complex. The framework would need to compare and reconcile the contents of multiple page <code>head</code> elements as they are loaded into the DOM so we leave this task to the developer.</p>
|
||||
|
||||
<p>The simplest approach is to add the same set of stylesheets and scripts into all your pages. If you need to load in specific scripts or styles for a particular page, bind to the <code>pagecreate</code> event (details below) to run the necessary code when a specific page ID is created. Following this approach will ensure that the code executes if the page is loaded directly or is pulled in and shown via Ajax.</p>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue