2

how can I make the effect in jQuery works for infinite and won't stop, Since when I run it right now, it works only for a couple of seconds(3 sec) & stop after that.

ex:

$('div').effect('Slide');
Q8Y
  • 3,801
  • 12
  • 39
  • 38

2 Answers2

3
(function looper(){
  // use callback function of the effect to call the outer looper function recursively.
  $('div').effect('Slide', function(){
    setTimeout(looper, 25); // add a timeout of needed
  });
})();
Headshota
  • 21,021
  • 11
  • 61
  • 82
1
setInterval(function(){$('div').effect('slide')}, 1000);
xdazz
  • 158,678
  • 38
  • 247
  • 274