【问题标题】:How can I get ride of a flicker in my skrollr animation in firefox and IE?如何在 Firefox 和 IE 中的 skrollr 动画中消除闪烁?
【发布时间】:2015-10-06 14:09:39
【问题描述】:

我有一个使用 skrollr 的单页动画。动画在 Safari 和 Chrome 中看起来不错,但在 IE 和 FF 中闪烁。在Firefox中,当在动画中上下滚动时,闪烁消失并且动画流畅,IE无论如何都会闪烁。动画有transform: translate3d(0px, 0px, 0px); 和背面可见性:隐藏;强制硬件加速并预加载所有图像。这是动画的链接:http://total-equipment.com/products/coiled-tubing-unit/ 这是代码结构:

HTML

<div class="container" id="arena"> 
            <div id="animate"
            data-anchor-target="#arena" 
>
                  <img class="lazy" data-anchor-target="#arena" src="img/animations/ctu_hq_animation_mb_4.0001.png" alt="" data-0-top="display:none;" data--100-top="display:block;" data--125-top="display:none;">
                  <img class="lazy" data-anchor-target="#arena" src="img/animations/ctu_hq_animation_mb_4.0003.png" alt="" data-0-top="display:none;" data--125-top="display:block;" data--150-top="display:none;">
                  <img class="lazy" data-anchor-target="#arena" src="img/animations/ctu_hq_animation_mb_4.0004.png" alt="" data-0-top="display:none;" data--150-top="display:block;" data--175-top="display:none;">
     </div>
</div>

CSS:

img {
    height: 500px;
    width: 800px;

}

#arena {
    position: relative;
    width: 1000px;
    height: 900px;
    background-size: 900px 800px;
}
#animate {
    width: 850px;
    height: 650px;
    position: fixed;
    background-size: 900px 800px;
    background-repeat: no-repeat;
    left: 10%;


}

【问题讨论】:

    标签: internet-explorer firefox animation flicker skrollr


    【解决方案1】:

    firebug 中有几行出现错误。例如,第 438 行如下所示:

    <img class="anim-image"data-anchor-target="#arena"  
    src="http://total-equipment.com/wp-content/themes/teas/img/animations/ctu_hq_animation_mb_4.0010.png" alt="" 
    data-0-top="display:none;" 
    data--450-top="display:block;"  
    data--500-top="display:none;">
    

    而它周围的所有其他线条看起来像:

    <img class="anim-image" data-smooth-scrolling="off" data-anchor-target="#arena" 
    src="" data-src="http://total-equipment.com/wp-content/themes/teas/img/animations/ctu_hq_animation_mb_4.0009.png" alt="" 
    data-0-top="display:none;" 
    data--400-top="display:block;" 
    data--450-top="display:none;">
    

    一个有data-src,而另一行有错误只有src。

    【讨论】:

    • 是的,对不起,我应该注意到,我已经尝试过全局和元素。该网站以 moto.oakley.com 上的动画为蓝本,该动画在第一次运行时在 Firefox 中也有轻微闪烁。
    • 好的,我确实在 firebug 中注意到有几行显示错误。我更新了我的答案给你一个想法。
    • 谢谢,我会调查错误。但我最近添加了那些 data-src attr。在它们被添加之前它仍然闪烁。我添加了它们以防止所有动画图像在移动设备上下载。标题中有一个函数,如果屏幕大小是桌面,则将 data-src 更改为 src,否则不会执行任何操作来阻止它们全部被下载。
    猜你喜欢
    • 1970-01-01
    • 2012-10-16
    • 2012-04-09
    • 2014-04-21
    • 2014-07-22
    • 1970-01-01
    • 2015-09-11
    • 2011-09-13
    • 1970-01-01
    相关资源
    最近更新 更多