📌  相关文章
📜  javascript 按标签名称设置元素宽度 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:11.711000             🧑  作者: Mango

代码示例2
var loadingBar = 200;

function animationBarOne(){    
    var elements = document.getElementsByClassName("loading-bar");
    for (var i = 0; i < elements.length; i++) {
        elements[i].style.width=(loadingBar+"px");
    }
    loadingBar++;
    if(loadingBar === 900){
         clearInterval(intervalId);
    }
}
var intervalId = setInterval(animationBarOne,1);