Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript set elements width by tag name

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #set #elements #width #tag
ADD COMMENT
Topic
Name
2+8 =