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 8197151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:40:59+00:00 2026-06-07T05:40:59+00:00

I load pages created from templates dynamically with a function from the Router (as

  • 0

I load pages created from templates dynamically with a function from the Router (as seen on some tutorials):

    changePage: function(page) { // page is a View object
        $(page.el).attr('data-role', 'page');
        page.render();
        $('body').append($(page.el));
        var transition = $.mobile.defaultPageTransition;
        if (this.firstPage) {
            transition = 'none';
            this.firstPage = false;
        }
        $.mobile.changePage($(page.el), {changeHash:false, transition: transition});
    }

The thing is when pages contain a JQ Mobile navbar, the active item is not highlighted. Actually it is, like 1 ms, then it’s not, I feel like it’s because the navbar is “reloaded”.
When I click 2 times on the same item, it works the second time.

Is there anybody who is able to have working navbars with jQuery Mobile and backbone.js?

  • 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-06-07T05:41:01+00:00Added an answer on June 7, 2026 at 5:41 am

    I ended up doing that:

    var activeTab = null;
    
    $('[data-role=page]').live('pageshow', function (event, ui) { 
        $.each($('[data-role=navbar] ul li').children(), function (i, val) {
            if (typeof activeTab !== "undefined" && activeTab != null && $(val).attr('id') == 'navTab' + activeTab)
                $(val).addClass($.mobile.activeBtnClass);
            else
                $(val).removeClass($.mobile.activeBtnClass);
        });
        activeTab = null;
    }); 
    

    And for each route that requires an active tab I just do for instance:

    r_search: function() { // Search page (form)
        activeTab = "Search";
        this.changePage(new SearchView());
    },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a page that will load divs from an external page
I created in php starting with file_get_content to load a HTML page, parse to
I currently create an object on page load with all possible key/value pairs and
some pages that use macros like: topusers or popularlabels are really slow to load.
I'm loading pages asynchronously with the jQuery load function, like this: tree.click(function() { if
Having created my model, view and controller in an attempt to get data from
I'm maintaining some existing pages and came across a bit of code from System.Threading
My scenario is, I have created a page and made some changes by applying
I want to load a UIView as the first page and some UIImageViews after
Can I get some help posting across different pages from a custom control? I've

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.