i have a simple javascript that add style to a slider when is turn to show, but i want to remove the style when the next slider come and also on mouse over remove the both style.
This is my javascript function that add style="width: 200px" to new slider and add style="width: 200px" to old.
function test(){
var read = document.getElementById("slide-0") // how can i add here to read the incremented slide-0, slide-1, slide-2
.removeAttribute("style",0);
}
function noEffect(pOld,pNew){
if (pOld){
pOld.style.width='10px';
}
if (pNew){
pNew.style.width='200px'; //this style become on active slider.
}
}
Slider html
<div class="slider" onMouseOver="test()">
<ul>
<li id="slide-0" class="slide" style="width: 10px"><img src="image.jpg"></li>
<li id="slide-1" class="slide" style="width: 200px"><img src="image.jpg"></li> <!-- this is active now -->
</ul>
</div>
Exactly what i want is to remove the style on both on mouseover.
Any help is appreciated.
<li id="slide-0" class="slide" style="width: 10px"><img src="image.jpg"></li> <li id="slide-0" class="slide" style="width: 200px"><img src="image.jpg"></li>