jQuery Mobile changePage in pagebeforeshow Flicker -


in several of jquery mobile pages, need ensure variables set before allowing page show. such, check these variables in pagebeforeshow event , if not present or correct, call $.mobile.changepage(...) inside pagebeforeshow event , return.

in jquery mobile 1.2.1 seemed work perfectly. however, i'm using jquery mobile 1.3.1 i've noticed odd rendering issue. when call changepage inside pagebeforeshow event, causes jquery mobile transition page requested, original page, firing pageshow event, , transitions page did changepage to.

while not major issue, inconvenience , causes unnecessary transitions. has else encountered issue , if so, have been able prevent unnecessary transitions , event firing? thanks!

example code:

$('#conditionalpage').on('pagebeforeshow', function () {     if (!somescopedvariable) {         $.mobile.changepage('#regularpage');         return;     } }  $('#conditionalpage').on('pageshow', function () {     ... \\ code gets fired though pagebeforeshow called changepage. } 

i had same problem. when changed page 1 page went fine. when changed with:

$.mobile.changepage("#frontpage"); 

the page shifted few times between 2 pages.

the problem solved moving functionality had defined in:

$(document).on('pagebeforeshow', '[data-role=page]', function () {...}) 

into:

$(document).on('pageinit', '[data-role=page]', function () {...}) 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -