/* superslide1.2 -- copyright 漏2012 澶ц瘽涓诲腑 */ (function($){ $.fn.slide=function(options){ $.fn.slide.deflunt={ effect : "fade", //鏁堟灉 || fade锛氭笎鏄撅紱 || top锛氫笂婊氬姩锛泑| left锛氬乏婊氬姩锛泑| toploop锛氫笂寰幆婊氬姩锛泑| leftloop锛氬乏寰幆婊氬姩锛泑| topmarquee锛氫笂鏃犵紳寰幆婊氬姩锛泑| leftmarquee锛氬乏鏃犵紳寰幆婊氬姩锛? autoplay:true, //鑷姩杩愯 delaytime : 600, //鏁堟灉鎸佺画鏃堕棿 intertime : 4800,//鑷姩杩愯闂撮殧銆傚綋effect涓烘棤缂濇粴鍔ㄧ殑鏃跺€欙紝鐩稿綋浜庤繍琛岄€熷害銆? defaultindex : 0,//榛樿鐨勫綋鍓嶄綅缃储寮曘€?鏄涓€涓? titcell:".hd li",//瀵艰埅鍏冪礌 maincell:".bd",//鍐呭鍏冪礌鐨勭埗灞傚璞? trigger: "mouseover",//瑙﹀彂鏂瑰紡 || mouseover锛氶紶鏍囩щ杩囪е鍙戯紱|| click锛氶紶鏍囩偣鍑昏е鍙戯紱 scroll:1,//姣忔婊氬姩涓暟銆? vis:1,//visible锛屽彲瑙嗚寖鍥翠釜鏁帮紝褰撳唴瀹逛釜鏁板皯浜庡彲瑙嗕釜鏁扮殑鏃跺€欙紝涓嶆墽琛屾晥鏋溿€? titonclassname:"on",//褰撳墠浣嶇疆鑷姩澧炲姞鐨刢lass鍚嶇о autopage:false,//绯荤粺鑷姩鍒嗛〉锛屽綋涓簍rue鏃讹紝titcell鍒欎负瀵艰埅鍏冪礌鐖跺眰瀵硅薄锛屽悓鏃剁郴缁熶細鍦╰itcell閲岄潰鑷姩鎻掑叆鍒嗛〉li鍏冪礌(1.2鐗堟湰鏂板) prevcell:".prev",//鍓嶄竴涓寜閽厓绱犮€? nextcell:".next"//鍚庝竴涓寜閽厓绱犮€? }; return this.each(function() { var opts = $.extend({},$.fn.slide.deflunt,options); var index=opts.defaultindex; var prevbtn = $(opts.prevcell, $(this)); var nextbtn = $(opts.nextcell, $(this)); var navobj = $(opts.titcell, $(this));//瀵艰埅瀛愬厓绱犵粨鍚? var navobjsize = navobj.size(); var conbox = $(opts.maincell , $(this));//鍐呭鍏冪礌鐖跺眰瀵硅薄 var conboxsize=conbox.children().size(); var slideh=0; var slidew=0; var selfw=0; var selfh=0; var autoplay = opts.autoplay; var inter=null;//setinterval鍚嶇о var oldindex = index; if(conboxsize"+(i+1)+"") } var navobj = $("li", navobj);//閲嶇疆瀵艰埅瀛愬厓绱犲璞? } conbox.children().each(function(){ //鍙栨渶澶у€? if( $(this).width()>selfw ){ selfw=$(this).width(); slidew=$(this).outerwidth(true); } if( $(this).height()>selfh ){ selfh=$(this).height(); slideh=$(this).outerheight(true); } }); switch(opts.effect) { case "top": conbox.wrap('
').css( { "position":"relative","padding":"0","margin":"0"}).children().css( {"height":selfh} ); break; case "left": conbox.wrap('
').css( { "width":conboxsize*slidew,"position":"relative","overflow":"hidden","padding":"0","margin":"0"}).children().css( {"float":"left","width":selfw} ); break; case "leftloop": case "leftmarquee": conbox.children().clone().appendto(conbox).clone().prependto(conbox); conbox.wrap('
').css( { "width":conboxsize*slidew*3,"position":"relative","overflow":"hidden","padding":"0","margin":"0","left":-conboxsize*slidew}).children().css( {"float":"left","width":selfw} ); break; case "toploop": case "topmarquee": conbox.children().clone().appendto(conbox).clone().prependto(conbox); conbox.wrap('
').css( { "height":conboxsize*slideh*3,"position":"relative","padding":"0","margin":"0","top":-conboxsize*slideh}).children().css( {"height":selfh} ); break; } //鏁堟灉鍑芥暟 var doplay=function(){ switch(opts.effect) { case "fade": case "top": case "left": if ( index >= navobjsize) { index = 0; } else if( index < 0) { index = navobjsize-1; } break; case "leftmarquee":case "topmarquee": if ( index>= 2) { index=1; } else if( index<0) { index = 0; } break; case "leftloop": case "toploop": var tempnum = index - oldindex; if( navobjsize>2 && tempnum==-(navobjsize-1) ) tempnum=1; if( navobjsize>2 && tempnum==(navobjsize-1) ) tempnum=-1; var scrollnum = math.abs( tempnum*opts.scroll ); if ( index >= navobjsize) { index = 0; } else if( index < 0) { index = navobjsize-1; } break; } switch (opts.effect) { case "fade":conbox.children().stop(true,true).eq(index).fadein(opts.delaytime).siblings().hide();break; case "top":conbox.stop(true,true).animate({"top":-index*opts.scroll*slideh},opts.delaytime);break; case "left":conbox.stop(true,true).animate({"left":-index*opts.scroll*slidew},opts.delaytime);break; case "leftloop": if(tempnum<0 ){ conbox.stop(true,true).animate({"left":-(conboxsize-scrollnum )*slidew},opts.delaytime,function(){ for(var i=0;i= 0){ for(var i=0;i= 0){ for(var i=0;i