简体   繁体   English

如何使用phonegap消除HTML页面切换之间的白色闪烁

[英]How to remove white flash between html page switch using phonegap

I am using phonegap to develop an app. 我正在使用phonegap开发应用程序。 I am not using any frameworks like jQuery mobile or anything of that sort. 我没有使用jQuery mobile之类的框架或任何此类框架。 Just HTML, JavaScript and CSS. 只是HTML,JavaScript和CSS。 Each page within the app has its own html file. 应用程序中的每个页面都有其自己的html文件。

The problem I have is that when I click on a link to go from one page to the next page there is this small short white flash. 我遇到的问题是,当我单击链接以从一页转到下一页时,会出现这种小的白色短闪烁。 I guess the DOM has to be loaded from scratch so thats why it goes to white for a moment until elements start to be loaded into the DOM. 我猜想DOM必须从头开始加载,这就是为什么它会变成白色一段时间,直到元素开始被加载到DOM中。

The strange thing is that on some pages (the ones that have almost no javascript) the flash is so short that its unnoticable on iOS devices (on android all pages have noticeable white transition when going to a new page). 奇怪的是,在某些页面(几乎没有javascript的页面)上,闪光灯是如此之短,以至于它在iOS设备上不明显(在android上,所有页面在进入新页面时都会出现明显的白色过渡)。

Is there any way to remove that white "flash" between page switching/transitions? 有什么办法可以消除页面切换/转换之间的白色“闪光”? It makes the app look laggy and very glitchy and I must solve it before I can deliver this app. 它使该应用看起来很笨拙,而且很容易出现故障,在交付该应用之前,我必须先解决它。

Add this to the css elements your transitioning: 将此添加到转换的css元素中:

 -webkit-transform:translate3d(0,0,0);
  transform:translate3d(0,0,0);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM