I have a UL containing list elements. I need to create an effect that highlights each list item in order and changes their background colour.
This is just a highlight affect that will add / remove a class every second and move along the list.
Basic html:
<ul id="looping-list">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
etc...
</ul>
I am currently stuck at this:
var ul = document.getElementById("looping-list");
var items = ul.getElementsByTagName("li");
for (var i = 0; i < items.length; i++) {
}
Thanks. If required I can alter the html of the list to give an id to each of the elements or a data attribute as they are coming from a PHP for loop.
No jQuery on this one too.