在iOS上的jQuery Mobile PhoneGap应用程序转换后,为什么页面会闪烁/闪烁? [英] Why do the pages blink/flicker after transitions in my jQuery Mobile PhoneGap app on iOS?
问题描述
我有一个jQuery Mobile应用程序,我已使用PhoneGap转换为iOS应用程序。我正在使用jQM的1.1.0版本。
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).
当最初在iPhone模拟器中运行应用程序的PhoneGap版本时,我在每次页面转换后都会出现闪烁/闪烁 - 好像页面正在显示,清除然后重新显示 - 所有只有一秒钟。当我在设备上运行它时发生了一些事情。
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.
我在Sarah-Jane的答案中应用了建议类似的问题。
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?
推荐答案
这家伙解决了这个问题 - 它对我有用:
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';
});
并将所有jQM页面包装在一个< div id =中容器>
And wrap all your jQM pages in a single <div id="container">
这篇关于在iOS上的jQuery Mobile PhoneGap应用程序转换后,为什么页面会闪烁/闪烁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!