1;(function($){ 2// å¾çè½®ææä»¶ 3$.fn.UISlide = function(options){ 4var defaults = { 5playTime :6000, // é´éæ¶é´ 6duration :300, // å»¶è¿æ¶é´ 7direction :'left', // æ¹å 8easing :'easeInOutQuad', // èªå¨ææ¾æ¶ easing æ¹å¼ 9clickEasing :'easeOutCubic' // ç¹å»æ¶ easing æ¹å¼ 10}; 11var opts = $.extend({}, defaults, options); // åæ°åå¹¶ 12var slide = { 13// ææ¾è°ç¨åä¸äºåéçåå§å 14play: function(opts, me){ 15var that = this, 16isPlay; 17that.me = me; 18that.picList = me.find('ul'); // å¾çå表 19that.title = me.find('span').find('a'); // å¾çæ é¢ 20that.oNum = me.find('dl'); // æ°åæé® 21that.lis = that.picList.find('li'); // li 22that.size = that.lis.length; // å¾ççæ°é 23that.lisWidth = that.lis.width(); 24that.isPlay = isPlay; // æ¯å¦èªå¨ææ¾ 25for (var p in opts) { // opts ç»å®å° slide 26that[p] = opts[p]; 27} 28that.setNums().setTitle(); 29if(that.size > 1){ // 妿å¾çæ°é大äºåè½®æ 30that.autoPlay().slideEvent(); 31} 32}, 33// 设置æé® 34setNums: function(){ 35var that = this, 36links, // å¾çç龿¥ 37me = that.me, 38size = that.size, 39oNum = that.oNum, // æé®å¯¹è±¡ 40arrTemp = []; 41links = that.picList.find('a').first(); 42that.title.html(links[0].title).attr('href', links[0].href); // æé¾æ¥ç title å 容æ¾å°æ 颿 䏿¾ç¤º 43for(var i=1; i<=size; i++){ 44arrTemp.push('<dd>' + i + '</dd>'); 45} 46oNum.append(arrTemp.join('')); 47that.slideNum = oNum.find('dd'); 48that.numWidth = (that.slideNum.width() + parseInt(that.slideNum.css('margin-right')) + 2) * size + 1; // æ°åæé®å®½åº¦ 49that.setTitle(); 50return that; 51}, 52// èªå¨ææ¾ 53autoPlay: function(){ 54var that = this, 55activePos, 56direction = that.direction, 57picList = that.picList, 58slideNum = that.slideNum, 59playTime = that.playTime; 60that.isPlay = setInterval(function (){ 61activePos = that.oNum.find('.active').index(); 62if(direction == 'left'){ 63if(activePos == (that.size - 1)){ 64direction = 'right'; 65activePos --; 66} else { 67activePos ++; 68} 69} else { 70if(activePos == 0){ 71direction = 'left'; 72activePos ++; 73} else { 74activePos --; 75} 76} 77picList.stop().animate({'margin-left': 0 - activePos * (that.lisWidth + 3)}, {duration: that.duration, easing: that.easing}); 78slideNum.removeClass('active').eq(activePos).addClass('active'); 79var links = picList.find('a').eq(activePos); 80that.title.html(links[0].title).attr('href', links[0].href); 81}, playTime); 82return that; 83}, 84// 设置æ é¢ 85setTitle: function(){ 86var that = this; 87that.oNum.width(that.numWidth + 2); // 设置æ°åæé®å®½åº¦ 88that.picList.width((that.lisWidth + 3) * that.size); // 设置å¾ç容卿»å®½åº¦ 89that.slideNum.first().addClass('active'); 90return that; 91}, 92// ç»å®æ°åæé®äºä»¶ 93slideEvent: function(){ 94var that = this, 95slideNum = that.slideNum; 96slideNum.click(function(){ 97var thisNum = $(this).index(); 98that.picList.stop().animate({"margin-left":0 - thisNum * (that.lisWidth + 3)}, {duration:that.duration, easing:that.clickEasing}); 99slideNum.removeClass('active').eq(thisNum).addClass('active'); 100var links = that.picList.find('a').eq(thisNum); 101that.title.html(links[0].title).attr('href', links[0].href); 102}); 103// é¼ æ å°ç»é¢ä¸ä»»æä½ç½®ï¼åæ¢ææ¾ 104that.me.hover(function(){ 105clearInterval(that.isPlay); 106}, function(){ 107that.autoPlay(); 108}) 109return that; 110} 111}; 112/* 113æ¬ä»£ç ç±ãç´ æå®¶åãæ¶éå¹¶ç¼è¾æ´ç; 114å°éä»äººå³å¨ææ; 115转载请ä¿çãç´ æå®¶åã龿¥ - ãwww.sucaijiayuan.comã 116*/ 117return this.each(function(){ // $(a,b) æ¹å¼è°ç¨ 118slide.play(opts, $(this)); 119}); 120} 121})(jQuery);
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.