I'm trying to change the css rules on a class called active
which have static css already but i would like to alter a rule in it to make an div animate slide. i don´t know how to target a class instead of an element with the name of the class.
Javascript
var active = document.getElementsByClassName('active');
active.style.color = 'red';
I´ve tried both these methods but none seems to work.
var i = 0;
while(i < divs.length) {
if(divs[i].className == "active") {
var b = 0;
for (var a = 0; a < 10; a++){
divs[i].style.left = b+'em';
b += 6;
}
}
i++;
}
I´t wont add left to the css rule nor color.
CSS
.active{
position:absolute;
left:-60em;
Jquery is not an option in this case.