jeudi 1 octobre 2015

How to loop script

I'm trying to make script, that works like step by step slider with a period of clicks. The main goal was to make LABEL be the trigger of that clicks. I made the script, but how to make it work with loop: when it reaches the last LABEL it goes to first in cycle? Any help? http://ift.tt/1M3CvuO

$('label').each(function(i, e) {
  var delay = 1000;
  setTimeout(function() {
    $('label').removeClass('button-checked');
    $(e).trigger("click").addClass('button-checked');

  }, i * delay);
});




Aucun commentaire:

Enregistrer un commentaire