PageSourceSearch

https://www.2fdeal.com/static/js/plugin/banner/jquery.SuperSlide.js?v=1.3402

js 2fdeal.com collected 2026-10-04 07:39:15 UTC 9,618 bytes, 201 lines download raw bytes

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			showType:"img"//显示方式 || img: 图片形式;	||	 bg: 背景形式
21		};
22
23		return this.each(function() {
24			var opts = $.extend({},$.fn.slide.deflunt,options);
25			var index=opts.defaultIndex;
26			var prevBtn = $(opts.prevCell, $(this));
27			var nextBtn = $(opts.nextCell, $(this));
28			var navObj = $(opts.titCell, $(this));//导航子元素结合
29			var navObjSize = navObj.size();
30			var conBox = $(opts.mainCell, $(this));//内容元素父层对象
31			var conBoxSize=conBox.children().size();
32			var slideH=0;
33			var slideW=0;
34			var selfW=0;
35			var selfH=0;
36			var autoPlay = opts.autoPlay;
37			var inter=null;//setInterval名称 
38			var oldIndex = index;
39
40			if(conBoxSize<opts.vis) return; //当内容个数少于可视个数,不执行效果。
41
42			//处理分页
43			if( navObjSize==0 )navObjSize=conBoxSize;
44			if( opts.autoPage ){
45				var tempS = conBoxSize-opts.vis;
46				navObjSize=1+parseInt(tempS%opts.scroll!=0?(tempS/opts.scroll+1):(tempS/opts.scroll)); 
47				navObj.html(""); 
48				for( var i=0; i<navObjSize; i++ ){ navObj.append("<li>"+(i+1)+"</li>") }
49				var navObj = $("li", navObj);//重置导航子元素对象
50			}
51
52			conBox.children().each(function(){ //取最大值
53				if(opts.showType=='bg'){
54					$(this).find('a').css('background-image', 'url('+$(this).find('img').attr('src')+')');
55					$(this).find('img').remove();
56				}
57				if( $(this).width()>selfW ){ selfW=$(this).width(); slideW=$(this).outerWidth(true);  }
58				if( $(this).height()>selfH ){ selfH=$(this).height(); slideH=$(this).outerHeight(true);  }
59			});
60
61			switch(opts.effect)
62			{
63				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;
64				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;
65				case "leftLoop":
66				case "leftMarquee":
67					conBox.children().clone().appendTo(conBox).clone().prependTo(conBox); 
68					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;
69				case "topLoop":
70				case "topMarquee":
71					conBox.children().clone().appendTo(conBox).clone().prependTo(conBox); 
72					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;
73			}
74			//-----------导航居中----------
75			if(opts.vis==1){
76				var settitCellPos=function(){
77					var navBox=navObj.parent().parent(),
78						objW=conBox.parent().parent().width(),
79						objH=conBox.parent().parent().height(),
80						navBoxLeft=(objW-navBox.width())/2;
81					
82					slideW=objW;
83					slideH=objH;
84					
85					navBox.css('left', navBoxLeft+'px');
86					conBox.css('width', objW*(conBox.find('li').size())+'px').parent().css('width', objW+'px').find('div, li, img').css('width', objW+'px');
87				}
88				jQuery(window).resize(function(){settitCellPos();});
89				settitCellPos();
90			}
91			//-----------导航居中----------
92
93			//效果函数
94			var doPlay=function(){
95	
96				switch(opts.effect)
97				{
98					case "fade": case "top": case "left": if ( index >= navObjSize) { index = 0; } else if( index < 0) { index = navObjSize-1; } break;
99					case "leftMarquee":case "topMarquee": if ( index>= 2) { index=1; } else if( index<0) { index = 0; } break;
100					case "leftLoop": case "topLoop":
101						var tempNum = index - oldIndex; 
102						if( navObjSize>2 && tempNum==-(navObjSize-1) ) tempNum=1;
103						if( navObjSize>2 && tempNum==(navObjSize-1) ) tempNum=-1;
104						var scrollNum = Math.abs( tempNum*opts.scroll );
105						if ( index >= navObjSize) { index = 0; } else if( index < 0) { index = navObjSize-1; }
106					break;
107				}
108				switch (opts.effect)
109				{
110					case "fade":conBox.children().stop(true,true).eq(index).fadeIn(opts.delayTime).siblings().hide();break;
111					case "top":conBox.stop(true,true).animate({"top":-index*opts.scroll*slideH},opts.delayTime);break;
112					case "left":conBox.stop(true,true).animate({"left":-index*opts.scroll*slideW},opts.delayTime);break;
113					case "leftLoop":
114						if(tempNum<0 ){
115								conBox.stop(true,true).animate({"left":-(conBoxSize-scrollNum )*slideW},opts.delayTime,function(){
116								for(var i=0;i<scrollNum;i++){ conBox.children().last().prependTo(conBox); }
117								conBox.css("left",-conBoxSize*slideW);
118							});
119						}
120						else{
121							conBox.stop(true,true).animate({"left":-( conBoxSize + scrollNum)*slideW},opts.delayTime,function(){
122								for(var i=0;i<scrollNum;i++){ conBox.children().first().appendTo(conBox); }
123								conBox.css("left",-conBoxSize*slideW);
124							});
125						}break;// leftLoop end
126
127					case "topLoop":
128						if(tempNum<0 ){
129								conBox.stop(true,true).animate({"top":-(conBoxSize-scrollNum )*slideH},opts.delayTime,function(){
130								for(var i=0;i<scrollNum;i++){ conBox.children().last().prependTo(conBox); }
131								conBox.css("top",-conBoxSize*slideH);
132							});
133						}
134						else{
135							conBox.stop(true,true).animate({"top":-( conBoxSize + scrollNum)*slideH},opts.delayTime,function(){
136								for(var i=0;i<scrollNum;i++){ conBox.children().first().appendTo(conBox); }
137								conBox.css("top",-conBoxSize*slideH);
138							});
139						}break;//topLoop end
140
141					case "leftMarquee":
142						var tempLeft = conBox.css("left").replace("px",""); 
143
144						if(index==0 ){
145								conBox.animate({"left":++tempLeft},0,function(){
146									if( conBox.css("left").replace("px","")>= 0){ for(var i=0;i<conBoxSize;i++){ conBox.children().last().prependTo(conBox); }conBox.css("left",-conBoxSize*slideW);}
147								});
148						}
149						else{
150								conBox.animate({"left":--tempLeft},0,function(){
151									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);}
152								});
153						}break;// leftMarquee end
154
155						case "topMarquee":
156						var tempTop = conBox.css("top").replace("px",""); 
157							if(index==0 ){
158									conBox.animate({"top":++tempTop},0,function(){
159										if( conBox.css("top").replace("px","") >= 0){ for(var i=0;i<conBoxSize;i++){ conBox.children().last().prependTo(conBox); }conBox.css("top",-conBoxSize*slideH);}
160									});
161							}
162							else{
163									conBox.animate({"top":--tempTop},0,function(){
164										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);}
165									});
166							}break;// topMarquee end
167
168
169				}//switch end
170					navObj.removeClass(opts.titOnClassName).eq(index).addClass(opts.titOnClassName);
171					oldIndex=index;
172			};
173			//初始化执行
174			doPlay();
175
176			//自动播放
177			if (autoPlay) {
178					if( opts.effect=="leftMarquee" || opts.effect=="topMarquee"  ){
179						index++; inter = setInterval(doPlay, opts.interTime);
180						conBox.hover(function(){if(autoPlay){clearInterval(inter); }},function(){if(autoPlay){clearInterval(inter);inter = setInterval(doPlay, opts.interTime);}});
181					}else{
182						 inter=setInterval(function(){index++; doPlay() }, opts.interTime); 
183						$(this).hover(function(){if(autoPlay){clearInterval(inter); }},function(){if(autoPlay){clearInterval(inter); inter=setInterval(function(){index++; doPlay() }, opts.interTime); }});
184					}
185			}
186
187			//鼠标事件
188			var mst;
189			if(opts.trigger=="mouseover"){
190				navObj.hover(function(){ clearTimeout(mst); index=navObj.index(this); mst = window.setTimeout(doPlay,200); }, function(){ if(!mst)clearTimeout(mst); });
191			}else{ navObj.click(function(){index=navObj.index(this);  doPlay(); })  }
192			nextBtn.click(function(){ index++; doPlay(); });
193			prevBtn.click(function(){  index--; doPlay(); });
194
195    	});//each End
196
197	};//slide End
198
199
200})(jQuery);
201

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.