function bannerlistfn(a,b,c,d,e,f){ var $bannermaxwapdom=a; var windowwidth=$(window).width(); var timeshow=0; var array=0; var timeoff=0; var imgpos=$bannermaxwapdom.find("ul").find("li"); var cloneone=imgpos.first().clone(); $bannermaxwapdom.find("ul").append(cloneone); $bannermaxwapdom.find("li").width(windowwidth); var liwidth=imgpos.width(); var lilength=$bannermaxwapdom.find("li").length; $bannermaxwapdom.find("ul").width(liwidth*(lilength+1)); var $imgbtnlist=b; settimeout(function(i){ timeshow++; (timeshow == 1) ? $bannermaxwapdom.find("ul").fadein() : $bannermaxwapdom.find("ul").hide(); },20); (e === undefined) ? e=2000 : e=e; function imglistbtn (){ for (var i=0; i < lilength-1; i++ ){ $imgbtnlist.append(""); } $imgbtnlist.children().eq(0).addclass("current"); $imgbtnlist.children().click(function(){ var index=$(this).index(); array=index; bannerimglist(index); $imgbtnlist.children().eq(array).addclass("current").siblings().removeclass("current"); }); } imglistbtn(); function bannerimglist(a){ $bannermaxwapdom.find("ul").animate({left: -a*windowwidth},400) } function settime(){ timeoff=setinterval(function(){ array++; move(); },e) } (f) ? settime() : settime; c.stop(true).click(function(){ array--; move(); }); d.stop(true).click(function(){ array++; move(); }); function move(){ if (array == lilength){ $bannermaxwapdom.find("ul").css({left:0}); array=1; } if (array == -1){ $bannermaxwapdom.find("ul").css({left:-liwidth*(lilength-1)}); array=lilength-2 } $bannermaxwapdom.find("ul").stop(true).animate({ left:-array*liwidth }); (array == lilength-1) ? $imgbtnlist.children().eq(0).addclass("current").siblings().removeclass("current") : $imgbtnlist.children().eq(array).addclass("current").siblings().removeclass("current"); } $bannermaxwapdom.hover(function(){ clearinterval(timeoff); },function(){(f) ? settime() : settime;}); }