Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do the pages blink/flicker after transitions in my jQuery Mobile PhoneGap app on iOS?

I have a jQuery Mobile app that I've converted to an iOS app using PhoneGap. I'm using version 1.1.0 of jQM.

I'm using "fade" transitions between pages (as I read they were less demanding).

When initially running the PhoneGap version of the app in the iPhone Simulator I was getting a flicker/flash after every page transition - as if the page was being displayed, cleared and then redisplay - all with a fraction of a second. Some thing happened when I ran it on the device.

I applied the advice in Sarah-Jane's answer to a similar question.

This fixed the problem in the simulator, but not on the actual device.

Has anyone experienced this problem, and found a solution?

like image 463
dommer Avatar asked May 04 '12 17:05

dommer


2 Answers

This guy solved the problem - it worked for me:

http://outof.me/fixing-flickers-jumps-of-jquery-mobile-transitions-in-phonegap-apps/

CSS:

body {
    /* Setting body margins to 0 to have proper positioning of #container div */
    margin: 0;
}

/* #container div with absolute position and 100% width and height so it takes up whole window */
#container {
    position: absolute;
    width: 100%;
    height: 100%;
}

JS:

$(document).one("mobileinit", function () {

    // Setting #container div as a jqm pageContainer
    $.mobile.pageContainer = $('#container');

    // Setting default page transition to slide
    $.mobile.defaultPageTransition = 'slide';

});

And wrap all your jQM pages in a single <div id="container">

like image 191
Jeff Avatar answered Nov 03 '22 08:11

Jeff


Fade transition blinks mostly you should change it to slide or some other transition mode.

like image 1
Tanveer Avatar answered Nov 03 '22 09:11

Tanveer