1/* SuperSlide1.2 -- Copyright ©2012 大è¯ä¸»å¸ 2 */ 3(function($){ 4 $.fn.slide=function(options){ 5 $.fn.slide.deflunt={ 6 effect : "fade", //ææ || fadeï¼æ¸æ¾ï¼ || topï¼ä¸æ»å¨ï¼|| leftï¼å·¦æ»å¨ï¼|| topLoopï¼ä¸å¾ªç¯æ»å¨ï¼|| leftLoopï¼å·¦å¾ªç¯æ»å¨ï¼|| topMarqueeï¼ä¸æ ç¼å¾ªç¯æ»å¨ï¼|| leftMarqueeï¼å·¦æ ç¼å¾ªç¯æ»å¨ï¼ 7 autoPlay:false, //èªå¨è¿è¡ 8 delayTime : 500, //æææç»æ¶é´ 9 interTime : 2500,//èªå¨è¿è¡é´éãå½effect为æ ç¼æ»å¨çæ¶åï¼ç¸å½äºè¿è¡é度ã 10 defaultIndex : 0,//é»è®¤çå½åä½ç½®ç´¢å¼ã0æ¯ç¬¬ä¸ä¸ª 11 titCell:".hd li",//导èªå ç´ 12 mainCell:".bd",//å 容å ç´ çç¶å±å¯¹è±¡ 13 trigger: "mouseover",//è§¦åæ¹å¼ || mouseoverï¼é¼ æ ç§»è¿è§¦åï¼|| clickï¼é¼ æ ç¹å»è§¦åï¼ 14 scroll:1,//æ¯æ¬¡æ»å¨ä¸ªæ°ã 15 vis:1,//visibleï¼å¯è§èå´ä¸ªæ°ï¼å½å 容个æ°å°äºå¯è§ä¸ªæ°çæ¶åï¼ä¸æ§è¡ææã 16 titOnClassName:"on",//å½åä½ç½®èªå¨å¢å çclassåç§° 17 autoPage:false,//ç³»ç»èªå¨å页ï¼å½ä¸ºtrueæ¶ï¼titCellå为导èªå ç´ ç¶å±å¯¹è±¡ï¼åæ¶ç³»ç»ä¼å¨titCelléé¢èªå¨æå ¥å页liå ç´ (1.2çæ¬æ°å¢) 18 prevCell:".prev",//åä¸ä¸ªæé®å ç´ ã 19 nextCell:".next"//åä¸ä¸ªæé®å ç´ ã 20 }; 21 22 return this.each(function() { 23 var opts = $.extend({},$.fn.slide.deflunt,options); 24 var index=opts.defaultIndex; 25 var prevBtn = $(opts.prevCell, $(this)); 26 var nextBtn = $(opts.nextCell, $(this)); 27 var navObj = $(opts.titCell, $(this));//导èªåå ç´ ç»å 28 var navObjSize = navObj.size(); 29 var conBox = $(opts.mainCell , $(this));//å 容å ç´ ç¶å±å¯¹è±¡ 30 var conBoxSize=conBox.children().size(); 31 var slideH=0; 32 var slideW=0; 33 var selfW=0; 34 var selfH=0; 35 var autoPlay = opts.autoPlay; 36 var inter=null;//setIntervalåç§° 37 var oldIndex = index; 38 39 if(conBoxSize<opts.vis) return; //å½å 容个æ°å°äºå¯è§ä¸ªæ°ï¼ä¸æ§è¡ææã 40 41 //å¤çå页 42 if( navObjSize==0 )navObjSize=conBoxSize; 43 if( opts.autoPage ){ 44 var tempS = conBoxSize-opts.vis; 45 navObjSize=1+parseInt(tempS%opts.scroll!=0?(tempS/opts.scroll+1):(tempS/opts.scroll)); 46 navObj.html(""); 47 for( var i=0; i<navObjSize; i++ ){ navObj.append("<li>"+(i+1)+"</li>") } 48 var navObj = $("li", navObj);//é置导èªåå ç´ å¯¹è±¡ 49 } 50 51 conBox.children().each(function(){ //åæå¤§å¼ 52 if( $(this).width()>selfW ){ selfW=$(this).width(); slideW=$(this).outerWidth(true); } 53 if( $(this).height()>selfH ){ selfH=$(this).height(); slideH=$(this).outerHeight(true); } 54 }); 55 56 switch(opts.effect) 57 { 58 case "top": conBox.wrap('<div class="tempWrap" style="overflow:hidden; position:relative; height:'+opts.vis*slideH+'px"></div>').css( { "position":"relative","padding":"0","margin":"0"}).children().css( {"height":selfH} ); break; 59 case "left": conBox.wrap('<div class="tempWrap" style="overflow:hidden; position:relative; width:'+opts.vis*slideW+'px"></div>').css( { "width":conBoxSize*slideW,"position":"relative","overflow":"hidden","padding":"0","margin":"0"}).children().css( {"float":"left","width":selfW} ); break; 60 case "leftLoop": 61 case "leftMarquee": 62 conBox.children().clone().appendTo(conBox).clone().prependTo(conBox); 63 conBox.wrap('<div class="tempWrap" style="overflow:hidden; position:relative; width:'+opts.vis*slideW+'px"></div>').css( { "width":conBoxSize*slideW*3,"position":"relative","overflow":"hidden","padding":"0","margin":"0","left":-conBoxSize*slideW}).children().css( {"float":"left","width":selfW} ); break; 64 case "topLoop": 65 case "topMarquee": 66 conBox.children().clone().appendTo(conBox).clone().prependTo(conBox); 67 conBox.wrap('<div class="tempWrap" style="overflow:hidden; position:relative; height:'+opts.vis*slideH+'px"></div>').css( { "height":conBoxSize*slideH*3,"position":"relative","padding":"0","margin":"0","top":-conBoxSize*slideH}).children().css( {"height":selfH} ); break; 68 } 69 70 //ææå½æ° 71 var doPlay=function(){ 72 switch(opts.effect) 73 {
74 case "fade": case "top": case "left": if ( index >= navObjSize) { index = 0; } else if( index < 0) { index = navObjSize-1; } break; 75 case "leftMarquee":case "topMarquee": if ( index>= 2) { index=1; } else if( index<0) { index = 0; } break; 76 case "leftLoop": case "topLoop": 77 var tempNum = index - oldIndex; 78 if( navObjSize>2 && tempNum==-(navObjSize-1) ) tempNum=1; 79 if( navObjSize>2 && tempNum==(navObjSize-1) ) tempNum=-1; 80 var scrollNum = Math.abs( tempNum*opts.scroll ); 81 if ( index >= navObjSize) { index = 0; } else if( index < 0) { index = navObjSize-1; } 82 break; 83 } 84 switch (opts.effect) 85 { 86 case "fade":conBox.children().stop(true,true).eq(index).fadeIn(opts.delayTime).siblings().hide();break; 87 case "top":conBox.stop(true,true).animate({"top":-index*opts.scroll*slideH},opts.delayTime);break; 88 case "left":conBox.stop(true,true).animate({"left":-index*opts.scroll*slideW},opts.delayTime);break; 89 case "leftLoop": 90 if(tempNum<0 ){ 91 conBox.stop(true,true).animate({"left":-(conBoxSize-scrollNum )*slideW},opts.delayTime,function(){ 92 for(var i=0;i<scrollNum;i++){ conBox.children().last().prependTo(conBox); } 93 conBox.css("left",-conBoxSize*slideW); 94 }); 95 } 96 else{ 97 conBox.stop(true,true).animate({"left":-( conBoxSize + scrollNum)*slideW},opts.delayTime,function(){ 98 for(var i=0;i<scrollNum;i++){ conBox.children().first().appendTo(conBox); } 99 conBox.css("left",-conBoxSize*slideW); 100 }); 101 }break;// leftLoop end 102 103 case "topLoop": 104 if(tempNum<0 ){ 105 conBox.stop(true,true).animate({"top":-(conBoxSize-scrollNum )*slideH},opts.delayTime,function(){ 106 for(var i=0;i<scrollNum;i++){ conBox.children().last().prependTo(conBox); } 107 conBox.css("top",-conBoxSize*slideH); 108 }); 109 } 110 else{ 111 conBox.stop(true,true).animate({"top":-( conBoxSize + scrollNum)*slideH},opts.delayTime,function(){ 112 for(var i=0;i<scrollNum;i++){ conBox.children().first().appendTo(conBox); } 113 conBox.css("top",-conBoxSize*slideH); 114 }); 115 }break;//topLoop end 116 117 case "leftMarquee": 118 var tempLeft = conBox.css("left").replace("px",""); 119 120 if(index==0 ){ 121 conBox.animate({"left":++tempLeft},0,function(){ 122 if( conBox.css("left").replace("px","")>= 0){ for(var i=0;i<conBoxSize;i++){ conBox.children().last().prependTo(conBox); }conBox.css("left",-conBoxSize*slideW);} 123 });
124 } 125 else{ 126 conBox.animate({"left":--tempLeft},0,function(){ 127 if( conBox.css("left").replace("px","")<= -conBoxSize*slideW*2){ for(var i=0;i<conBoxSize;i++){ conBox.children().first().appendTo(conBox); }conBox.css("left",-conBoxSize*slideW);} 128 }); 129 }break;// leftMarquee end 130 131 case "topMarquee": 132 var tempTop = conBox.css("top").replace("px",""); 133 if(index==0 ){ 134 conBox.animate({"top":++tempTop},0,function(){ 135 if( conBox.css("top").replace("px","") >= 0){ for(var i=0;i<conBoxSize;i++){ conBox.children().last().prependTo(conBox); }conBox.css("top",-conBoxSize*slideH);} 136 }); 137 } 138 else{ 139 conBox.animate({"top":--tempTop},0,function(){ 140 if( conBox.css("top").replace("px","")<= -conBoxSize*slideH*2){ for(var i=0;i<conBoxSize;i++){ conBox.children().first().appendTo(conBox); }conBox.css("top",-conBoxSize*slideH);} 141 }); 142 }break;// topMarquee end 143 144 145 }//switch end 146 navObj.removeClass(opts.titOnClassName).eq(index).addClass(opts.titOnClassName); 147 oldIndex=index; 148 }; 149 //åå§åæ§è¡ 150 doPlay(); 151 152 //èªå¨ææ¾ 153 if (autoPlay) { 154 if( opts.effect=="leftMarquee" || opts.effect=="topMarquee" ){ 155 index++; inter = setInterval(doPlay, opts.interTime); 156 conBox.hover(function(){if(autoPlay){clearInterval(inter); }},function(){if(autoPlay){clearInterval(inter);inter = setInterval(doPlay, opts.interTime);}}); 157 }else{ 158 inter=setInterval(function(){index++; doPlay() }, opts.interTime); 159 $(this).hover(function(){if(autoPlay){clearInterval(inter); }},function(){if(autoPlay){clearInterval(inter); inter=setInterval(function(){index++; doPlay() }, opts.interTime); }}); 160 } 161 } 162 163 //é¼ æ äºä»¶ 164 var mst; 165 if(opts.trigger=="mouseover"){ 166 navObj.hover(function(){ clearTimeout(mst); index=navObj.index(this); mst = window.setTimeout(doPlay,200); }, function(){ if(!mst)clearTimeout(mst); }); 167 }else{ navObj.click(function(){index=navObj.index(this); doPlay(); }) } 168 nextBtn.click(function(){ index++; doPlay(); }); 169 prevBtn.click(function(){ index--; doPlay(); }); 170 171 });//each End 172 173 };//slide End 174 175})(jQuery); 176
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.