1/* 2 * sGallery 1.0 - simple gallery with jQuery 3 * made by bujichong 2009-11-25 4 * ä½è ï¼ä¸ç¾è« 2009-11-25 5 * http://hi.baidu.com/bujichong/ 6 * 欢è¿äº¤æµè½¬è½½ï¼ä½è¯·å°éä½è å³å¨ææï¼æ ææä»¶æ¥æºåä½è 7 */ 8 9(function ($) { 10$.fn.sGallery = function (o) { 11 return new $sG(this, o); 12 //alert('do'); 13 }; 14 15 var settings = { 16 thumbObj:null,//é¢è§å¯¹è±¡ 17 titleObj:null,//æ é¢ 18 botLast:null,//æé®ä¸ä¸ä¸ª 19 botNext:null,//æé®ä¸ä¸ä¸ª 20 thumbNowClass:'now',//é¢è§å¯¹è±¡å½åçclass,é»è®¤ä¸ºnow 21 slideTime:800,//å¹³æ»è¿æ¸¡æ¶é´ 22 autoChange:true,//æ¯å¦èªå¨åæ¢ 23 changeTime:5000,//èªå¨åæ¢æ¶é´ 24 delayTime:100//é¼ æ ç»è¿æ¶ååºçå»¶è¿æ¶é´ 25 }; 26 27 $.sGalleryLong = function(e, o) { 28 this.options = $.extend({}, settings, o || {}); 29 var _self = $(e); 30 var set = this.options; 31 var thumb; 32 var size = _self.size(); 33 var nowIndex = 0; //å®ä¹å ¨å±æé 34 var index;//å®ä¹å ¨å±æé 35 var startRun;//é¢å®ä¹èªå¨è¿è¡åæ° 36 var delayRun;//é¢å®ä¹å»¶è¿è¿è¡åæ° 37 38//åå§å 39 _self.eq(0).show(); 40 41//䏻忢彿° 42function fadeAB () { 43 if (nowIndex != index) { 44 if (set.thumbObj!=null) { 45 $(set.thumbObj).removeClass().eq(index).addClass(set.thumbNowClass);} 46 _self.eq(nowIndex).stop(false,true).fadeOut(set.slideTime); 47 _self.eq(index).stop(true,true).fadeIn(set.slideTime); 48 $(set.titleObj).eq(nowIndex).hide();//æ°å¢å title 49 $(set.titleObj).eq(index).show();//æ°å¢å title 50 nowIndex = index; 51 if (set.autoChange==true) { 52 clearInterval(startRun);//éç½®èªå¨åæ¢å½æ° 53 startRun = setInterval(runNext,set.changeTime);} 54 } 55} 56 57//忢å°ä¸ä¸ä¸ª 58function runNext() { 59 index = (nowIndex+1)%size; 60 fadeAB(); 61} 62 63//ç¹å»ä»»ä¸å¾ç 64 if (set.thumbObj!=null) { 65 thumb = $(set.thumbObj); 66//åå§å 67 thumb.eq(0).addClass(set.thumbNowClass); 68 thumb.bind("mousemove",function(event){ 69 index = thumb.index($(this)); 70 fadeAB(); 71 delayRun = setTimeout(fadeAB,set.delayTime); 72 clearTimeout(delayRun); 73 event.stopPropagation(); 74 }) 75 } 76 77//ç¹å»ä¸ä¸ä¸ª 78 if (set.botNext!=null) { 79 var botNext = $(set.botNext); 80 botNext.mousemove(function () {
81 runNext(); 82 return false; 83 }); 84 } 85 86//ç¹å»ä¸ä¸ä¸ª 87 if (set.botLast!=null) { 88 var botLast = $(set.botLast); 89 botLast.mousemove(function () { 90 index = (nowIndex+size-1)%size; 91 fadeAB(); 92 return false; 93 }); 94 } 95 96//èªå¨è¿è¡ 97 if (set.autoChange==true) { 98 startRun = setInterval(runNext,set.changeTime); 99 } 100 101} 102 103var $sG = $.sGalleryLong; 104 105})(jQuery); 106 107function slide(Name,Class,Width,Height,fun){ 108 $(Name).width(Width); 109 $(Name).height(Height); 110 111 if(fun == true){ 112 $(Name).append('<div class="title-bg"></div><div class="title"></div><div class="change"></div>') 113 var atr = $(Name+' div.changeDiv a'); 114 var sum = atr.length; 115 for(i=1;i<=sum;i++){ 116 var title = atr.eq(i-1).attr("title"); 117 var href = atr.eq(i-1).attr("href"); 118 $(Name+' .change').append('<i>'+i+'</i>'); 119 $(Name+' .title').append('<a href="'+href+'">'+title+'</a>'); 120 } 121 $(Name+' .change i').eq(0).addClass('cur'); 122 } 123 $(Name+' div.changeDiv a').sGallery({//对象æåå±ï¼å±å å å«å¾çåæ é¢ 124 titleObj:Name+' div.title a', 125 thumbObj:Name+' .change i', 126 thumbNowClass:Class 127 }); 128 $(Name+" .title-bg").width(Width); 129} 130 131//缩ç¥å¾ 132jQuery.fn.LoadImage=function(scaling,width,height,loadpic){ 133 if(loadpic==null)loadpic="../images/msg_img/loading.gif"; 134return this.each(function(){ 135 var t=$(this); 136 var src=$(this).attr("src") 137 var img=new Image(); 138 img.src=src; 139 //èªå¨ç¼©æ¾å¾ç 140 var autoScaling=function(){ 141 if(scaling){ 142 if(img.width>0 && img.height>0){ 143 if(img.width/img.height>=width/height){ 144 if(img.width>width){ 145 t.width(width); 146 t.height((img.height*width)/img.width); 147 }else{ 148 t.width(img.width); 149 t.height(img.height); 150 } 151 } 152 else{ 153 if(img.height>height){ 154 t.height(height); 155 t.width((img.width*height)/img.height); 156 }else{ 157 t.width(img.width); 158 t.height(img.height); 159 } 160 } 161 } 162 } 163 } 164 //å¤çffä¸ä¼èªå¨è¯»åç¼åå¾ç 165 if(img.complete){ 166 autoScaling(); 167 return; 168 } 169 $(this).attr("src",""); 170 var loading=$("<img alt=\"å è½½ä¸...\" title=\"å¾çå è½½ä¸...\" src=\""+loadpic+"\" />"); 171 172 t.hide(); 173 t.after(loading); 174 $(img).load(function(){ 175 autoScaling(); 176 loading.remove(); 177 t.attr("src",this.src); 178 t.show(); 179 //$('.photo_prev a,.photo_next a').height($('#big-pic img').height()); 180 }); 181 }); 182} 183 184//å䏿»å¨ä»£ç 185function startmarquee(elementID,h,n,speed,delay){ 186 var t = null; 187 var box = '#' + elementID; 188 $(box).hover(function(){ 189 clearInterval(t); 190 }, function(){ 191 t = setInterval(start,delay); 192 }).trigger('mouseout'); 193 function start(){ 194 $(box).children('ul:first').animate({marginTop: '-='+h},speed,function(){ 195 $(this).css({marginTop:'0'}).find('li').slice(0,n).appendTo(this); 196 }) 197 } 198} 199 200//TAB忢 201function SwapTab(name,title,content,Sub,cur){ 202 $(name+' '+title).mouseover(function(){ 203 $(this).addClass(cur).siblings().removeClass(cur); 204 $(content+" > "+Sub).eq($(name+' '+title).index(this)).show().siblings().hide(); 205 }); 206}
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.