192
rated 0 times
[
197]
[
5]
/ answers: 1 / hits: 15082
/ 10 Years ago, tue, march 4, 2014, 12:00:00
I'm using swipejs from swipejs.com, the home page slider uses this logic to highlight the active un-ordered list element and I'd like to know how this while condition works.
<ul id=bullets>
<li></li>
....
</ul>
var bullets = document.getElementById('bullets').getElementsByTagName('li');
var elem = document.getElementById('mySwipe');
window.mySwipe = Swipe(elem, {
callback: function(index, element) {
var i = bullets.length;
while (i--) {
bullets[i].className = ' ';
}
bullets[index].className = 'on';
}
});
More From » html