2012-02-01 15 views
2

我怎么能让效果在jQuery的作品无限,不会停止,因为当我现在运行它,它只能在几秒钟后(3秒)&停止后。如何使jQuery效果适用于无限?

例如:

$('div').effect('Slide'); 

回答

1
setInterval(function(){$('div').effect('slide')}, 1000); 
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 
    }); 
})();