Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Mobile, one footer fragment for whole site
    primarykey
    data
    text
    <p>I'm <strong>not</strong> asking how to get a fixed footer.</p> <p>I've a structure with both multi-page and single page. I'd like to know how to use only one html fragment for the whole site. I'm really looking for a solution because I'd like to edit the footer in only one place and see the modification in all pages.</p> <p>Thanks.</p> <p>EDIT: I'm developing a mobile application to be wrapped with PhoneGap, so I'm looking for client side solutions.</p> <p>SOLUTION (pushing together the solutions by @maco and adapting them to my case):</p> <pre><code>$(function() { // load the templates $('body').append('&lt;div id="module"&gt;&lt;/div&gt;'); $('#module').load('templates/module.html :jqmData(role="page")',function() { // save the actual footer and header var hdhtml = $('#module :jqmData(role="header")').clone(); var fthtml = $('#module :jqmData(role="footer")').clone(); // removes the header/footer $(':jqmData(role="header")').remove(); $(':jqmData(role="footer")').remove(); // load at the correct place the header/footer $(':jqmData(role="page")').prepend(hdhtml).append(fthtml).page().trigger('pagecreate'); // delete the temporary div $($(this).html()).replaceAll(this).attr('id', 'module'); }); // set the class "ui-btn-active" for the active page $(document).live('pagecreate', function() { // get the current page var currentPage = window.location.pathname; currentPage = currentPage.substring(currentPage.lastIndexOf("/") + 1, currentPage.length).split("&amp;")[0]; // remove the class from the footer $($.mobile.activePage + ':jqmData(role="footer") li a') .removeClass('ui-btn-active ui-state-persist'); // add the class to the link that points to the particular href $($.mobile.activePage + ':jqmData(role="footer") li a[href="' + currentPage + '"]').addClass('ui-btn-active ui-state-persist'); }); }); </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.
 

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