(function($) { var bannar_scroll = function(element){ var cur = 0; var moveto = 0; var scroll_count = $('.scroll-slice').size(); var isie6 = $.browser.msie && $.browser.version <= 6; $(element).each(function(i){ $(this).click(function(){ var currentindex = $('.scrollselect').index('.smallpic'); cur = i; $(element).find('a').removeclass('scrollselect').end().find('a').eq(cur).addclass('scrollselect'); $('.scroll-slice').eq(currentindex).stop().animate({ opacity:'hide' }, (500*2), null, null); $('.scroll-slice').eq(cur).stop().animate({ opacity:'show' }, (500*2), null, null); }); }); scroll_timer = setinterval(function(){ moveto = (cur + 1) % scroll_count; $(element).eq(moveto).click(); } , 10000); $('.smallpic').hover( function(){ clearinterval(scroll_timer); }, function(){ scroll_timer = setinterval(function(){ moveto = (cur + 1) % scroll_count; $(element).eq(moveto).click(); },10000); } ); }; $.fn.bannar_scroll = function() { var bannar_scroll = new bannar_scroll(this); }; })(jquery);