0

在网站上,有一个带有褪色图片的幻灯片,底部有一个水平滚动的新贴纸。两者都是用javascript动画的。让我烦恼的是,在图片开始淡入淡出时,新贴纸会在短时间内停止滚动。这似乎在很大程度上取决于浏览器可用的资源。

如何让两个脚本顺利运行?

这是用于淡化图片的代码:

this.b_slidenow = function(){
    var check1,maxalpha,curralpha;
    check1=ptofade.style.MozOpacity;
    maxalpha=(100-factor*u)/100*105;
    if(check1<=maxalpha/100){u=u+1;}
    curralpha=100-factor*u;
    ptofade.style.filter="Alpha(Opacity="+curralpha+")";
    ptofade.style.MozOpacity=curralpha/100;
    ptofade.style.opacity=curralpha/100;
    if(u<steps){ //slide not finished
        if(stopit=="0"){mytimeout=setTimeout(function(){self.b_slidenow();},ftim);}
        else {this.b_slide();}
    }
    else{ //slide finished
        if(startim<emax){
            ptofade.style.visibility="hidden";
            ptofade.style.zIndex=1;
            pnext.style.zIndex=2;
            startim=startim+1;u=0;
            mytimeout=setTimeout(function(){self.b_slide();},stim);
        }
        else{
            ptofade.style.visibility="hidden";
            ptofade.style.zIndex=1;
            pnext.style.zIndex=2;
            startim=1;u=0;
            mytimeout=setTimeout(function(){self.b_slide();},stim);
        }
    }
}

这是用于滚动代码的代码:

function TICKER_tick() {
    if(!TICKER_PAUSED) document.getElementById(ticker).scrollLeft += TICKER_SPEED * (TICKER_RIGHTTOLEFT ? -1 : 1);
    if(TICKER_RIGHTTOLEFT && document.getElementById(ticker).scrollLeft <= 0) document.getElementById(ticker).scrollLeft = document.getElementById(ticker).scrollWidth - document.getElementById(ticker).offsetWidth;
    if(!TICKER_RIGHTTOLEFT && document.getElementById(ticker).scrollLeft >= document.getElementById(ticker).scrollWidth - document.getElementById(ticker).offsetWidth) document.getElementById(ticker).scrollLeft = 0;
    window.setTimeout("TICKER_tick()", 20);
}

该站点仅用于内部信息亭屏幕,将使用 chrome 呈现。

4

0 回答 0