PageSourceSearch

http://sanbohk.com/template/temp/static/js/indexnews.js

js sanbohk.com collected 2026-10-02 23:29:31 UTC 6,861 bytes, 243 lines download raw bytes

1$(function() {
2    // 首页轮播
3    (function() {
4        var sup    = $("#banner"),
5            // 图片
6            pics   = sup.find(".pics li"),
7            curr_p = pics.eq(0),
8            next_p = null,
9            // 下标
10            idxs   = sup.find(".idxs li"),
11            curr_i = idxs.eq(0),
12            next_i = null,
13            // 按钮
14            left   = sup.find(".btns .left"),
15            right  = sup.find(".btns .right"),
16            // 记录切换
17            idx    = 0,
18            idx_m  = pics.length-1,
19            tt     = 0,
20            delay  = 5000;
21
22        // 初始化
23        $(window).on("load", function() {
24            idxs.hover(idxHoverOn, function(){});
25            sup.hover(banHoverOn, banHoverOut);
26            left.on("click", function(){btnClick(idxDec());});
27            right.on("click", function(){btnClick(idxInc());});
28            auto();
29        });
30
31        // 自动切换控制
32        function auto() {
33            tt = setTimeout(function() {
34                fade(idxInc());
35            }, delay);
36        }
37        // 切换控制
38        function fade(i) {
39            clearTimeout(tt);
40            curr_p.stop(false, true).fadeOut(500);
41            curr_p = next_p = pics.eq(i).stop(false, true).fadeIn();
42
43            curr_i.removeClass("on");
44            curr_i = next_i = idxs.eq(i).addClass("on");
45            auto();
46        }
47
48        // idx递增递减
49        function idxInc() {
50            return idx===idx_m? idx=0: ++idx;
51        }
52        function idxDec() {
53            return idx===0? idx=idx_m: --idx;
54        }
55
56        // 左右按钮唤出控制
57        function banHoverOn() {
58            left.stop().animate({"left":100}, 152);
59            right.stop().animate({"right":100}, 152);
60        }
61        function banHoverOut() {
62            left.stop().animate({"left":-52});
63            right.stop().animate({"right":-52});
64        }
65        // 按钮点击控制
66        function btnClick(i) {
67            fade(i);
68        }
69        // 下标hover控制
70        function idxHoverOn(elem) {
71            clearTimeout(tt);
72            idx = $(this).index();
73            fade(idx);
74        }
75    })();
76
77    (function() {
78        var sup = $('.navgation'),
79            navs = $("#nav li"),
80            navs_1 = navs.filter('.n1'),
81            navs_2 = navs_1.siblings(),
82            items  = $('#subNavs .innerWrapper div'),
83            curr_i = $(),
84            opened = false,
85            tt = 0;
86
87        navs_2.hover(function(idx) {
88            clearTimeout(tt);
89            idx = $(this).index()-1;
90            if (!opened) {
91                sup.stop(false).animate({'height':90}, {'duration':300, 'easing':'easeInOutQuint'});
92                opened = true;
93            }
94            curr_i.stop(false,true).fadeOut(300);
95            curr_i = items.eq(idx).stop(false, true).fadeIn(300);
96        }, function() {
97            tt = setTimeout(slideUp, 300);
98        });
99        items.hover(function() {
100            clearTimeout(tt);
101        }, function() {
102            tt = setTimeout(slideUp,300);
103        })
104
105        navs_1.hover(slideUp);
106
107        function slideUp() {
108            sup.stop(false).animate({'height':44}, {'duration':300, 'easing':'easeInOutQuint'});
109            opened = false;
110        }
111    }());
112
113
114    // 栏目滑动
115    (function() {
116        var sup       = $('#items .innerWrapper'),
117
118            // 容器
119            container = sup.find('dl'),
120            items     = container.find('dd'),
121            item0     = items.eq(0),
122            items_w   = item0.width()+parseInt(item0.css('margin-right')),
123            item0     = null,
124            items_l   = items.length,
125
126            // 按钮
127            left      = sup.find('.btnPrev'),
128            right     = sup.find('.btnNext'),
129
130            // 变量记录
131            idx       = 0,
132            idx_m     = items_l - 3;
133
134			//odd:填充背景色
135			// container.find('dd:odd').css({"background":"#e7d9a9"});
136
137			// 鼠标经过,左右按钮淡进淡出
138			sup.hover(function(){
139				left.stop(false,true).fadeIn();
140				right.stop(false,true).fadeIn();
141			}).parent().hover(function(){
142			},function(){
143				left.stop(false,true).fadeOut();
144				right.stop(false,true).fadeOut();
145			});
146            var i = 0;
147			container.find('dd:eq(0)').find(".link2").css("cursor","pointer");
148			container.find('dd').append("<div class=\"mask\"></div>");
149            // container.find('dd').each(function() {
150            //     $(this).append("<div class=\"mask mask" + (++i) +"\"></div>");
151            // });
152			container.find('dd').hover(function(){
153				$(this)
154				.find(".mask")
155				.stop(false,true)
156				.fadeIn()
157				.siblings(".link1")
158				.stop(true,false).animate({left:35+"px",opacity:1})
159				.siblings(".link2")
160				.stop(true,false).animate({right:35+"px",opacity:1})
161			},function(){
162				$(".link1").stop(true,false).animate({left:0+"px",opacity:0});
163				$(".link2").stop(true,false).animate({right:0+"px",opacity:0});
164				$(".mask").stop(false,true).fadeOut();
165			})
166    }());
167    
168    //新闻滚动
169    function news_scroll(){
170	var nb = $(".inews_box"),
171					ul = nb.find('ul'),
172					up = $(".news_btn .up"),
173					down = $(".news_btn .down"),
174					idx = 1,
175					delay = 4000,
176					speed = 300,
177					len = nb.find("li").length,
178					maxtop = - (len-1)*44;
179					
180					
181					
182				nb.hover(function(){				
183					clearInterval(autoplay);
184				},function(){
185					autoplay = setInterval(ap,delay);																				
186				}).trigger('mouseleave');
187				
188				up.on('click',function(){
189					clearInterval(autoplay);
190					if(idx == 1){
191						idx = len;				
192						ul.animate({marginTop:'+=44px'},speed,function(){
193						ul.css({marginTop:maxtop});
194						
195					});		
196						
197					}else{
198						idx --;
199						ul.stop(false,true).animate({marginTop:'+=44px'},speed);
200					}
201					autoplay = setInterval(ap,delay);
202					return false;
203				});
204				
205					down.on('click',function(){
206						clearInterval(autoplay);
207						if(idx == len){
208							idx = 1;
209							ul.animate({marginTop:'-=44px'},speed,function(){
210							ul.css({marginTop:'0'});				
211					});
212							
213						}else{
214							idx++;
215							ul.stop(false,true).animate({marginTop:'-=44px'},speed);
216						}
217						autoplay = setInterval(ap,delay);
218						return false;
219					});	
220									
221				function ap(){					
222					idx++;
223					if(idx<=len){					
224						ul.stop().animate({marginTop:'-=44px'},speed);
225					}else{
226						idx = 1;
227						ul.animate({marginTop:'-=44px'},speed,function(){
228						ul.css({marginTop:'0'});
229						});					
230					}											
231				};	
232	
233};
234	news_scroll();//新闻滚动
235    
236});
237	
238    
239    
240
241
242
243

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.