jquery how to fire the same event every 5 seconds
问题 I've built a simple carousel with left and right scroll. Now I want to scroll automatically every 5 seconds. Here's my code: function carousel(){ $j('#carousel_ul li:first').before($j('#carousel_ul li:last')); $j('#right_scroll img').click(function(){ var item_width = $j('#carousel_ul li').outerWidth() + 10; var left_indent = parseInt($j('#carousel_ul').css('left')) - item_width; $j('#carousel_ul:not(:animated)').animate({'left' : left_indent},800, 'easeOutExpo',function(){ $j('#carousel_ul