coderslay
coderslay

Reputation: 14370

How to load a page dynamically depending upon some flag using jquerymobile

In my index page there are many pages like

data-role="page1"
date-role="page2"
date-role="page3"

Now i need to show any of this page as soon as i open the index page... How to control this change just before the page is shown?

I tried to bind the pagebeforeshow on page1 like this

$("#page1").live("pagebeforeshow", function(e) {
    flag = window.location.search.substr(1);
    if(flag=='something') {
        $.mobile.changePage("#page2");
    }
});

Although it moves to page2 but i am able to see this transition happening in front of my eyes on Android Browser.. How to do this in background?

Upvotes: 0

Views: 117

Answers (1)

codaniel
codaniel

Reputation: 5253

How about this instead

$.mobile.changePage('#page2', {transition:'none'});

Also binding to pageinit works.

Upvotes: 2

Related Questions