1$.fn.jqslider = function() { 2 var fun = function(parentObj){ 3 var picTotal = parentObj.find('.list-box li').length; //æ»å ±å å¼ 4 var currentIndex = 0; // å½åè¦æ¾ç¤ºçç´¢å¼ 5 var toDisplayPicNumber = 1; // 宿¶å¨ä¸ä¸æ¬¡æ§è¡ç¨å°çç´¢å¼ 6 var timer = null; // 宿¶å¨å¯¹è±¡ 7 var hideIndex = 0; // è¦éèçç´¢å¼ 8 var iTime = 6000; // é´éæ¶é´ 9 10 //æå ¥HTML代ç 11 var speedHtml = '<div class="speed-box"><div class="speed-btn">'; 12 for(var i=0; i<picTotal; i++){ 13 speedHtml += '<a href="javascript:;"></a>'; 14 } 15 speedHtml += '</div></div>'; 16 $(speedHtml).appendTo(parentObj); //æå ¥è¿åº¦æé® 17 $('<a class="prev-btn" href="javascript:;"></a><a class="next-btn" href="javascript:;"></a>').appendTo(parentObj); //æå ¥å·¦å³æé® 18 parentObj.find('.list-box li').eq(0).css({'opacity':1,'z-index':2}); 19 parentObj.find('.speed-btn a').eq(0).addClass('selected'); 20 21 //ç§»ä¸ç§»ä¸æ¾ç¤ºéè 22 parentObj.hover(function(){ 23 clearTimeout(timer); 24 parentObj.find('.prev-btn').show(); 25 parentObj.find('.next-btn').show(); 26 },function(){ 27 parentObj.find('.prev-btn').hide(); 28 parentObj.find('.next-btn').hide(); 29 timer = setTimeout(PicNumClick, iTime); 30 //离å¼ä»æ°èµå¼ 31 toDisplayPicNumber = (currentIndex + 1 == picTotal ? 0 : currentIndex + 1); 32 }); 33 //ä¸ä¸ä¸ª 34 parentObj.find('.next-btn').click(function(){ 35 currentIndex = (currentIndex + 1 == picTotal ? 0 : currentIndex + 1); 36 DisplayPic(); 37 }); 38 //ä¸ä¸ä¸ª 39 parentObj.find('.prev-btn').click(function(){ 40 currentIndex = (currentIndex - 1 < 0 ? picTotal-1 : currentIndex -1); 41 DisplayPic(); 42 }); 43 //ä¸é´æé® 44 parentObj.find('.speed-btn a').click(function(){ 45 currentIndex = $(this).index(); 46 DisplayPic(); 47 }); 48 49 //å¾çåæ¢ææ 50 function DisplayPic() { 51 clearTimeout(timer); 52 if(currentIndex == hideIndex){return;} 53 parentObj.find('.list-box li').eq(currentIndex).css({'opacity':1,'z-index':2}); 54 parentObj.find('.list-box li').eq(hideIndex).css({'z-index':5}).stop(true,true).animate({'opacity':0}, 300 , function(){ 55 hideIndex = currentIndex; 56 $(this).css({'z-index':1}); 57 }); 58 parentObj.find('.speed-btn a').eq(currentIndex).addClass('selected').siblings().removeClass('selected'); 59 } 60 //循ç¯è°ç¨èªèº« 61 function PicNumClick() { 62 parentObj.find(".speed-btn a").eq(toDisplayPicNumber).trigger("click"); 63 toDisplayPicNumber = (toDisplayPicNumber + 1) % picTotal; 64 timer = setTimeout(PicNumClick,iTime); 65 } 66 setTimeout(PicNumClick, iTime); 67 }; 68 return $(this).each(function() { 69 fun($(this)); 70 }); 71}
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.