2016-09-29 47 views
0

我试图找到一种工作方式,让30个背景在另一个之后动画。
CSS无法在IE浏览器上工作& Firefox所以我尝试了jQuery,它在这两个浏览器上看起来“闪烁”。
我预先加载图像使用css:body:after {display:none;内容:网址URL URL等}jQuery的多个背景动画看起来闪烁在Firefox和IE上

$(function() { 
    setInterval("anim1()", 100); 
}); 

function anim1() { 
    var oCurBack = $('#fullback div.current'); 
    var oNxtBack = oCurBack.next(); 
    if (oNxtBack.length == 0) 
     return; 

    oNxtBack.addClass('current'); 
    oCurBack.removeClass('current').addClass('previous'); 
} 

CSS:

#fullback div { 
    z-index: 0; 
} 

#fullback div.current{ 
    position: fixed; 
    z-index: 2; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-position: center; 
    background-size: cover; 
    background-repeat: no-repeat; 
} 

#fullback div.previous{ 
    z-index: 1; 
} 

请告诉我,我怎样才能使它不会对IE & Firefox中的 “闪烁效果” 的工作。

回答

0

我错了用CSS虽然它闪烁一点在Firefox上仍:

#fullback div { 
    z-index: 0; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-position: center; 
    background-size: cover; 
    background-repeat: no-repeat; 
} 

#fullback div.current{ 
    z-index: 2; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-position: center; 
    background-size: cover; 
    background-repeat: no-repeat; 
} 

#fullback div.previous{ 
    z-index: 1; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-position: center; 
    background-size: cover; 
    background-repeat: no-repeat; 
}