Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7440769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:54:11+00:00 2026-05-29T10:54:11+00:00

I’m diving into writing a mobile app with jQuery Mobile/PhoneGap. I’m using this sample

  • 0

I’m diving into writing a mobile app with jQuery Mobile/PhoneGap. I’m using this sample template to start from, which uses HTML/JS to create the pages. Rather than have all the <page> tags in one single html file, he’s got it split up so it’s easier to edit.

Since I will have a separate file for each page, what’s the best way to include the tempated header/footer? I’ve only seen it where you need to copy and paste the whole footer->navbar code into each HTML page. This doesn’t seem like it should be. For example, if you want to change one menu item, you need to go into each page and change it.

What’s the solution that I’m missing?

Maybe I’m just not understanding jQuery Mobile. For example, their sidebar they use for their docs – is that sidebar code copy and pasted onto each page? That doesn’t make sense. It’s the same idea as the question I’m asking here about the footer.

http://jquerymobile.com/test/docs/pages/page-cache.html

This is what I’ve got that doesn’t seem right (and $.live('pageinit') isn’t working). This HTML is what goes on each HTML page:

<div id="mainFooter" data-position="fixed" data-id="mainFooter" data-role="footer" class="ui-footer ui-bar-a ui-footer-fixed fade ui-fixed-inline" role="contentinfo" style="top: 58px;">

And the JS

$.live('pageinit', function (event) {
    displayFooter();
});

function displayFooter() {
    $('#mainFooter').html('<div data-role="navbar" class="nav-glyphish-example" data-grid="d">' +
        '<ul>' +
        '<li><a href="#" id="menuitem1" data-icon="custom">Menu Item 1</a></li>' +
        '<li><a href="#" id="menuitem2" data-icon="custom">Menu Item 2</a></li>' +
        '<li><a href="#" id="menuitem3" data-icon="custom">Menu Item 3</a></li>' +
        '</ul>' +
        '</div>');
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:54:12+00:00Added an answer on May 29, 2026 at 10:54 am

    I’ve been trying to tackle this problem for a few days now and I’ve gotten really close to the solution. I use the following HTML:

    <body>
        <div data-role="page" id="page">
    
            <div data-role="header">
                <h1 id="title">Title</h1>
            </div><!-- /header -->
    
            <div data-role="content" id="content">  
                <p>Loading...</p>
            </div><!-- /content -->
    
            <div data-role="footer" id="footer" data-position="fixed">
                <div data-role="navbar" id="navbar">
                </div>
            </div><!-- /footer -->
        </div><!-- /page -->
    </body>
    

    And I’ve created the following functions to load the menu/content using ajax:

    $(document).on('pageinit', "#page", function() {
        // for example: displayFooter();
        loadContent("main");
        loadMenu("default");
    });
    
    function loadContent(location) {
        return $('#content').load("views/content/"+location+".html", function() { 
            $(this).trigger('create');
        });
    }
    function loadMenu(location) {
        $("#menu").remove();
        $("#navbar").remove();
    
        $("#footer").html('<div data-role="navbar" id="navbar">');
        $("#navbar").html('<ul id="menu"></ul>');
    
        $("#menu").load("views/menus/"+location+".html", function() { $("#menu").parent().navbar(); });
    
        return true;
    }
    

    The .trigger('create'); and .navbar(); are the methods required to keep the JQM styling correct, however, there’s still one little bug. The position of the menu (which is set using css top: …px) is sometimes not correct and moves itself to the correct position after the first tap. Really close though!

    Edit: By setting #footer to position: fixed; the minor bug I mentioned above is gone. Also, it’s easy to make a method that calculates the top (in px) for the #footer if the position caused by the top value by JQM is incorrect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.