繁体   English   中英

Skrollr,Safari,固定位置滞后

[英]Skrollr, Safari, fixed position lags

我现在正在玩视差并遇到问题:

这是标记

<div class="welcome"></div>
<div class="welcome2" data-0="top: 100%;" data-1000="top: 0%;"></div>
<div class="weclome_text">
    <h3 data-0="color: rgb(82,98,130);" data-1000="color: rgb(255,255,255);">Hello World</h3>
    <div class="scroll-button" data-0="opacity: 1;" data-300="opacity: 0;"></div>
</div>

和CSS:

html,body { margin: 0; padding: 0; font-family: Sans-serif; }

body {
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.welcome { position: fixed; top: 0; width: 100%; height: 100%; background: url(http://justdade.com/t/bg1.png) no-repeat; background-size: cover; }
.welcome2 { position: fixed; top: 100%; width: 100%; height: 100%; background: url(http://justdade.com/t/bg2.png) no-repeat; background-size: cover; }

.weclome_text {
    position: fixed; position: fixed; top: 50%; left: 50%; margin-left: -60px; margin-top: -60px; width: 120px; height: 120px; color: #526282;
    text-align: center;
}
.scroll-button { background: url(http://justdade.com/t/scroll-button.png); width: 60px; height: 60px; cursor: pointer; margin: 0 auto; }

的jsfiddle

在所有浏览器中,一切似乎都可以,期待Safari(桌面,iOS也可以)

按“滚动”箭头后,Safari滚动动画相当滞后。 我也注意到只有当我使用position:fixed时才会启动滚动滞后;

也许有人可以给我任何线索,我应该挖?

谢谢。

好的,所以我不确定问题究竟是什么。 但经过大量的谷歌搜索,我找到了解决方案。 它是:

div { -webkit-transform: translateZ(0);-webkit-backface-visibility: hidden;-webkit-perspective: 1000; }

我知道这不是最好的方式。 但它适合我。 显然,这会激活Safari浏览器上的硬件加速,动画就像魅力一样。

我也在用

data-0="transform: translate(0%,0%)" data-1200="transform: translate(0%, -100%)"

普林佐恩的道具。 而不是顶部:0; 上:100;

暂无
暂无

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

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