1// JavaScript Document 2$(function() { 3 var sWidth = $("#focus").width(); //è·åç¦ç¹å¾çå®½åº¦ï¼æ¾ç¤ºé¢ç§¯ï¼ 4 var len = $("#focus ul li").length; //è·åç¦ç¹å¾ä¸ªæ° 5 var index = 0; 6 var picTimer; 7 8 //以ä¸ä»£ç æ·»å æ°åæé®åæé®åçåéæé¿æ¡ 9 var btn = "<div class='btn'>"; 10 for(var i=0; i < len; i++) { 11 //btn += "<span>" + (i+1) + "</span>"; 12 btn += "<span> </span>"; 13 } 14 btn += "</div>" 15 $("#focus").append(btn); 16 $("#focus .btnBg").css("opacity",0.5); 17 18 //为æ°åæé®æ·»å é¼ æ æ»å ¥äºä»¶ï¼ä»¥æ¾ç¤ºç¸åºçå 容 19 $("#focus .btn span").mouseenter(function() { 20 index = $("#focus .btn span").index(this); 21 showPics(index); 22 }).eq(0).trigger("mouseenter"); 23 24 //æ¬ä¾ä¸ºå·¦å³æ»å¨ï¼å³ææliå ç´ é½æ¯å¨å䏿å左浮å¨ï¼æä»¥è¿ééè¦è®¡ç®åºå¤å´ulå ç´ ç宽度 25 $("#focus ul").css("width",sWidth * (len + 1)); 26 27 28 29 //é¼ æ æ»ä¸ç¦ç¹å¾æ¶åæ¢èªå¨ææ¾ï¼æ»åºæ¶å¼å§èªå¨ææ¾ 30 $("#focus").hover(function() { 31 clearInterval(picTimer); 32 },function() { 33 picTimer = setInterval(function() { 34 if(index == len) { //å¦æç´¢å¼å¼çäºliå ç´ ä¸ªæ°ï¼è¯´ææåä¸å¼ 徿æ¾å®æ¯ï¼æ¥ä¸æ¥è¦æ¾ç¤ºç¬¬ä¸å¼ å¾ï¼å³è°ç¨showFirPic()ï¼ç¶åå°ç´¢å¼å¼æ¸ é¶ 35 showFirPic(); 36 index = 0; 37 } else { //å¦æç´¢å¼å¼ä¸çäºliå ç´ ä¸ªæ°ï¼ææ®éç¶æåæ¢ï¼è°ç¨showPics() 38 showPics(index); 39 } 40 index++; 41 },3000); //æ¤3000代表èªå¨ææ¾çé´éï¼åä½ï¼æ¯«ç§ 42 }).trigger("mouseleave"); 43 44 //æ¾ç¤ºå¾ç彿°ï¼æ ¹æ®æ¥æ¶çindex弿¾ç¤ºç¸åºçå 容 45 function showPics(index) { //æ®é忢 46 var nowLeft = -index*sWidth; //æ ¹æ®indexå¼è®¡ç®ulå ç´ çleftå¼ 47 $("#focus ul").stop(true,false).animate({"left":nowLeft},500); //éè¿animate()è°æ´ulå ç´ æ»å¨å°è®¡ç®åºçposition 48 $("#focus .btn span").removeClass("on").eq(index).addClass("on"); //为å½åçæé®åæ¢å°éä¸çææ 49 } 50 51 function showFirPic() { //æåä¸å¼ å¾èªå¨åæ¢å°ç¬¬ä¸å¼ 徿¶ä¸ç¨ 52 $("#focus ul").append($("#focus ul li:first").clone()); 53 var nowLeft = -len*sWidth; //éè¿liå ç´ ä¸ªæ°è®¡ç®ulå ç´ çleftå¼ï¼ä¹å°±æ¯æåä¸ä¸ªliå ç´ çå³è¾¹ 54 $("#focus ul").stop(true,false).animate({"left":nowLeft},500,function() { 55 //éè¿callbackï¼å¨å¨ç»ç»æåæulå ç´ éæ°å®ä½å°èµ·ç¹ï¼ç¶åå 餿åä¸ä¸ªå¤å¶è¿å»çå ç´ 56 $("#focus ul").css("left","0"); 57 $("#focus ul li:last").remove(); 58 }); 59 $("#focus .btn span").removeClass("on").eq(0).addClass("on"); //为第ä¸ä¸ªæé®æ·»å éä¸çææ 60 } 61});
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.