我正在 iOS 和 Android 上构建一个 cordova 元素。
我有两个页面:index.html 和 home.html。在这两个页面上,我都有一个绝对定位的 div(带加载),它是 默认情况下在两个页面上都可见。在这里:
<body>
<div id="loading_page" class="loading_page"></div>
<section> my content </section>
</body>
和以下 CSS:
body {
background-color: #fff;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #00665d;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-ms-touch-action: none;
height: 100%;
width: 100%;
overflow: hidden;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.loading_page {
background: #fff;
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 25;
}
section {
position: absolute; /* tested with relative, too */
top: 85px;
left: 75px;
right: 15px;
bottom: 0;
}
我在 index.html 屏幕上,当我通过 JavaScript window.location.href = "home.html"
将用户重定向到另一个页面时,加载屏幕在第二部分消失了,使 index.html 页面的后台内容可见,然后 - 重定向到 home.html
有什么建议可以解决闪烁问题吗?仅在 iOS 上发生
最佳答案
如果您想完全控制您的页面和行为,请将它们作为一个 html 文件中的“页面部分”:http://demos.jquerymobile.com/1.4.1/pages/
我这样做是为了防止眨眼(在我的例子中是闪烁)。此外,您很可能遇到了 javascript 问题,请检查您的控制台以防万一
关于javascript - Phonegap Hybrid App - JavaScript Redirect 使绝对定位元素闪烁并显示后面的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33257463/