亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Jump problem in carousel chart
怪我咯
怪我咯 2017-05-19 10:34:28
0
1
530

There are four carousel items in total, and three can appear on the screen. I placed two copies side by side in the html to implement wireless carousel. However, when the position is at the starting point, clicking the forward button will cause a jump process. But when I execute it step by step in Chrome debugging, it doesn't jump. What's going on? The js code is as follows

pre.onclick=function(){              //pre為前移按鈕
        if(index==0){                 //index==0對應(yīng)屏幕出現(xiàn)前三個項
            index=4;
            oUl.style.transition='none';           //將css中的transition消除
            oUl.style.transform='translateX('+(-425)*index+'px)';   //移動到index==4
        }
        index--;
        clearInterval(timer);        //清除定時器
        oUl.style.transition='all 1s';    //設(shè)置過渡
        oUl.style.transform='translateX('+(-425)*index+'px)';   //移動到index==3
        timer=setInterval(move,2000);     //開啟定時器
    }
怪我咯
怪我咯

走同樣的路,發(fā)現(xiàn)不同的人生

reply all(1)
巴扎黑

Isn’t the initial value 0? After you click, it will jump to 4

oUl.style.transform='translateX('+(-425)*index+'px)';
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template