PageSourceSearch

https://www.bnbm.com/static/en/js/public.js

js bnbm.com collected 2026-10-06 04:47:07 UTC 12,782 bytes, 469 lines download raw bytes

1//导航
2//超过一定高度导航添加类名
3var nav = $("header"); //得到导航对象  
4var win = $(window); //得到窗口对象  
5var sc = $(document);//得到document文档对象。  
6win.scroll(function () {
7	if (sc.scrollTop() >= 100) {
8		nav.addClass("on");
9	} else {
10		nav.removeClass("on");
11	}
12})
13
14//移动端展开nav
15$('#navToggle').on('click', function () {
16	$('.m_nav').addClass('open');
17})
18//关闭nav
19$('.m_nav .top .closed').on('click', function () {
20	$('.m_nav').removeClass('open');
21})
22
23//二级导航  移动端
24$(".m_nav .ul li").click(function () {
25	$(this).children("div.dropdown_menu").slideToggle('slow')
26	$(this).siblings('li').children('.dropdown_menu').slideUp('slow');
27});
28
29var screenWidth = $(window).width();
30var screenHeight = $(window).height();
31//导航鼠标滑过效果
32if (screenWidth > 1024) {
33	$(".header .nav_content>li").hover(function () {
34		$(this).addClass('on');
35		$(this).children('div').show();
36	}, function () {
37		$(this).children('div').hide();
38		$(this).removeClass('on')
39	});
40	$(".header .nav_content>li>div>a").hover(function () {
41		$(this).addClass('on');
42	}, function () {
43		$(this).removeClass('on')
44	});
45	$(".header .nav_content .nav_con").hover(function () {
46		$(this).children('div').show();
47	}, function () {
48		$(this).children('div').hide();
49	});
50} else {
51	//中引文克隆
52	$(".header").append($('.nav_top .container1 .select').clone())
53
54	$(".index_brand").animate({
55		'bottom': '7%',
56		'opacity': '1',
57		'filter': 'alpha(opacity=100)'
58	}, 700)
59
60	$(".index_brand .left .h2_box").delay(1000).animate({
61		'left': '0',
62		'opacity': '1',
63		'filter': 'alpha(opacity=100)'
64	}, 700);
65
66	if (screenWidth <= 1024) {
67		for (var i = 0; i < $(".header li").length; i++) {
68			if ($('.header li:eq(' + i + ')').find('div').length > 0) {
69				var href = $('.header li:eq(' + i + ')').children('a').attr('href');
70				$('.header li:eq(' + i + ')').children('a').removeAttr('href');
71				$('.header li:eq(' + i + ')').children('a').attr('data-href', href);
72			}
73		};
74		$(".header .nav li>div").stop().animate({
75			'height': '0'
76		});
77		$(".header .nav li").removeClass('on');
78	}
79
80	//点击导航按钮关闭或展开导航
81	function bodyScroll(event) {
82		event.preventDefault();
83	}
84	$(".mobile-btn").click(function () {
85		if ($(this).hasClass('show')) {
86			$(".nav_top").show();
87			$(this).addClass('hidden').removeClass('show');
88			$(".header ul").css({
89				'left': '-100%'
90			});
91			$(".header .nav li").removeClass('on');
92			$(".header .nav li>div").css({
93				'height': '0'
94			})
95			$(".header").css({
96				"top": '52px'
97			})
98			$(".bannerBox .bannerSlide video").show();
99			document.body.removeEventListener('touchmove', bodyScroll, false);
100			$("body").css({ "position": "initial", "height": "auto" });
101		} else {
102			$(".nav_top").hide();
103			$(".header").css({
104				"top": '0'
105			})
106			$(this).addClass('show').removeClass('hidden');
107			$(".header ul").css({
108				'left': '0'
109			});
110
111			$(".bannerBox .bannerSlide video").hide();
112
113			document.body.addEventListener('touchmove', bodyScroll, { passive: false }, false);
114			$('body').css({ 'position': 'fixed', "width": "100%" });
115		}
116	})
117
118	$(".header .nav_content li>a").click(function () {
119		if ($(this).parent('li').hasClass('on')) {
120			var data_href = $(this).attr('data-href');
121			$(this).attr('href', data_href).parent('li').siblings().parent('a').removeAttr('href');
122		}
123		$(this).parent('li').addClass('on').siblings().removeClass('on');
124		var aLength = $(this).siblings('div').find('a').length;
125		$(this).siblings('div').stop().animate({
126			'height': aLength * 47
127		}).parent('li').siblings().find('div').stop().animate({
128			'height': '0'
129		});
130	})
131}
132/*if(screenWidth>=500){
133		 var leftHeight=$(".server_c_content .left").height();
134		var rightHeight=$(".server_c_content .right").height();
135		if(leftHeight>=rightHeight){
136				$(".server_c_content .right").css({
137					'position': 'absolute',
138					'right': 0,
139					'top': '50%',
140					'-webkit-transform': 'translateY(-50%)',
141					'-moz-transform': 'translateY(-50%)',
142					'-ms-transform': 'translateY(-50%)',
143					'-o-transform': 'translateY(-50%)',
144					'transform': 'translateY(-50%)'
145				})
146		}else{
147				$(".server_c_content .left").css({
148					'position': 'absolute',
149					'left': 0,
150					'top': '50%',
151					'-webkit-transform': 'translateY(-50%)',
152					'-moz-transform': 'translateY(-50%)',
153					'-ms-transform': 'translateY(-50%)',
154					'-o-transform': 'translateY(-50%)',
155					'transform': 'translateY(-50%)'
156				})
157		}
158	}*/
159
160
161
162
163//鼠标往上滚动导航显示,往下滚动导航隐藏
164var scrollFunc = function (e) {
165	e = e || window.event;
166	//		$(".header ul").stop().animate({
167	//	        'left':'-100%'
168	//	    });
169
170	if (e.wheelDelta) {  //判断浏览器IE,谷歌滑轮事件   
171
172		if (e.wheelDelta > 0) { //当滑轮向上滚动时  
173
174		}
175		if (e.wheelDelta < 0) { //当滑轮向下滚动时   
176
177		}
178	} else if (e.detail) {  //Firefox滑轮事件 
179		if (e.detail > 0) { //当滑轮向上滚动时  
180
181		}
182		if (e.detail < 0) { //当滑轮向下滚动时  
183
184		}
185	}
186}
187
188//给页面绑定滑轮滚动事件  	
189if (document.addEventListener) {//firefox  	
190	document.addEventListener('DOMMouseScroll', scrollFunc, false);
191}
192
193//滚动滑轮触发scrollFunc方法  //ie 谷歌  	
194window.onmousewheel = document.onmousewheel = scrollFunc;
195
196//封装的页面滚动加入动画效果
197function scrollT($Dom) {
198	if ($Dom.offset()) {
199		if ($(window).scrollTop() + $(window).height() >= $Dom.offset().top + 200) {
200			return true;
201		}
202	}
203}
204
205//导航动画
206
207if ($(".brand_anchor,.f_title").length > 0) {
208	var offSetTop = $(".brand_anchor,.f_title").offset().top;
209}
210$(window).scroll(function () {
211	if (screenWidth > 1024) {
212		$(".index_brand").animate({
213			'bottom': '7%',
214			'opacity': '1',
215			'filter': 'alpha(opacity=100)'
216		}, 700);
217
218		$(".index_brand .left .h2_box").delay(1000).animate({
219			'left': '0',
220			'opacity': '1',
221			'filter': 'alpha(opacity=100)'
222		}, 700);
223	}
224
225	var scrollTop = $(window).scrollTop();
226	if (screenWidth > 1024) {
227		if (scrollTop >= offSetTop) {
228			$(".brand_anchor,.f_title").css({
229				'position': 'fixed',
230				'left': '0',
231				"top": '0'
232			})
233		} else {
234			$(".brand_anchor,.f_title").css({
235				'position': 'inherit',
236				'top': '0'
237			})
238		}
239	} else if (screenWidth <= 1024 && screenWidth > 500) {
240		if (scrollTop >= 52) {
241			$(".header").css({
242				'position': 'fixed',
243				'top': '0',
244				'opacity': '1',
245				'filter': 'alpha(opacity=100)'
246			});
247		} else {
248			$(".header").css({
249				'position': 'relative',
250				'top': '0'
251			})
252		}
253		if ((scrollTop + 104) >= offSetTop) {
254			$(".brand_anchor,.f_title").css({
255				'position': 'fixed',
256				'left': '0',
257				"top": '73px'
258			})
259		} else {
260			$(".brand_anchor,.f_title").css({
261				'position': 'inherit',
262				'top': '0'
263			})
264		}
265	} else {
266		if (scrollTop >= 52) {
267			$(".header").css({
268				'position': 'fixed',
269				'top': '0',
270				'opacity': '1',
271				'filter': 'alpha(opacity=100)'
272			});
273		} else {
274			$(".header").css({
275				'position': 'relative',
276				'top': '0'
277			})
278		}
279		if ((scrollTop + 112) >= offSetTop) {
280			$(".brand_anchor,.f_title").css({
281				'position': 'fixed',
282				'left': '0',
283				"top": '64px'
284			})
285		} else {
286			$(".brand_anchor,.f_title").css({
287				'position': 'inherit',
288				'top': '0'
289			})
290		}
291	}
292})
293
294if (screenWidth > 1024) {
295	//$(".footer_top .left li:eq(0)").addClass("on");
296	$(".footer_top .left li:eq(0)").hover(function () {
297		if ($(this).hasClass('on')) {
298			$(this).removeClass('on');
299		} else {
300			$(this).addClass('on');
301		}
302	})
303} else {
304	$(".footer_top .left li:eq(0)").on('click', function () {
305		var e = arguments.callee.caller.arguments[0] || event;
306		if (e && e.stopPropagation) {
307			e.stopPropagation();
308		} else if (window.event) {
309			window.event.cancelBubble = true;
310		}
311		if ($(this).hasClass('on')) {
312			$(this).removeClass('on');
313		} else {
314			$(this).addClass('on');
315		}
316	})
317}
318
319
320if (screenWidth > 1024) {
321	$(".brand_anchor a").on('click touchend', function () {
322		if ($(".brand_anchor").css("position") == "fixed") {
323			$("html, body").animate({
324				scrollTop: ($($(this).attr("href")).offset().top - 50) + "px"
325			}, 500);
326		} else {
327			$("html, body").animate({
328				scrollTop: ($($(this).attr("href")).offset().top - 100) + "px"
329			}, 500);
330		}
331		return false;
332	});
333} else if (screenWidth > 500 && screenWidth <= 1024) {
334	$(".brand_anchor a").on('click touchend', function () {
335		if ($(".brand_anchor").css("position") === "fixed") {
336			$("html, body").animate({
337				scrollTop: ($($(this).attr("href")).offset().top - 142) + "px"
338			}, 500);
339		} else {
340			$("html, body").animate({
341				scrollTop: ($($(this).attr("href")).offset().top - 186) + "px"
342			}, 500);
343		}
344		return false;
345	});
346} else {
347	$(".brand_anchor a").on('click touchend', function () {
348		if ($(".brand_anchor").css("position") === "fixed") {
349			$("html, body").animate({
350				scrollTop: ($($(this).attr("href")).offset().top - 115) + "px"
351			}, 500);
352		} else {
353			$("html, body").animate({
354				scrollTop: ($($(this).attr("href")).offset().top - 165) + "px"
355			}, 500);
356		}
357		return false;
358	});
359}
360
361$('body').bind('click', function (event) {
362	$(".footer_top .left li:eq(0)").removeClass('on');
363});
364
365
366/*$("body").on("click",".img_btn,.data_honor",function(){
367	var data_src=$(this).attr('data-src');
368	$("body").append('<img class="data_img" src='+data_src+'><span class="img_mask" onclick="test()"></span><div class="mask_a_btn"><span class="prev"><img src="http://1812115029.pool1-gcsite.make.yun300.cn/repository/image/4YExMB1uRNmrwcZcfgKcHw.png"></span><span class="next" ><img src="http://1812115029.pool1-gcsite.make.yun300.cn/repository/image/RHJgFuNjS2SkPPNY95-UtQ.png"></span></div>');
369	$("body").css("overflow","hidden");
370		$(".recruit_search .select_box").stop().slideUp();
371		
372		
373		
374	});
375	function test(){
376			$(".img_mask,.data_img,.mask_a_btn").remove();
377			$("body").css("overflow","auto"); 
378			k=0;
379	}*/
380
381
382//Img:要放图片的img元素,onload时传参可用this 
383//maxHeight  :img元素的高度,像素(图片框 最大高度) 
384//maxWidth:img元素的宽度,像素(图片框 最大宽度)
385$.fn.resizeImg = function () {
386	var _this = $(this);
387	var image = new Image();
388	_this.each(function () {
389		var newWidth = 0,
390			newHeight = 0,
391			maxWidth = $(this).parent()[0].offsetWidth,
392			maxHeight = $(this).parent()[0].offsetHeight;
393		//原图片原始地址(用于获取原图片的真实宽高,当<img>标签指定了宽、高时不受影响)
394		image.src = $(this)[0].src;
395		// 当图片比图片框小时不做任何改变 
396		if (image.width < maxWidth && image.height < maxHeight) {
397			newWidth = image.width;
398			newHeight = image.height;
399		} else
400		//原图片宽高比例 大于 图片框宽高比例,则以框的宽为标准缩放,反之以框的高为标准缩放
401		{
402			if (maxWidth / maxHeight <= image.width / image.height) //原图片宽高比例 大于 图片框宽高比例
403			{
404				newWidth = maxWidth;//以框的宽度为标准
405				newHeight = maxWidth * (image.height / image.width);
406			}
407			else {   //原图片宽高比例 小于 图片框宽高比例
408				newWidth = maxHeight * (image.width / image.height);
409				newHeight = maxHeight;//以框的高度为标准
410			}
411		}
412		$(this).css({ "width": newWidth, "height": newHeight, "marginTop": (maxHeight - newHeight) / 2 });
413		$(this).parent().css({ "textAlign": "center", "overflow": "hidden" });
414	});
415}
416
417var t_img; // 定时器
418var isLoad = true; // 控制变量
419
420// 判断图片加载状况,加载完成后回调
421isImgLoad(function () {
422	$(".resize_img").resizeImg();
423});
424
425// 判断图片加载的函数
426function isImgLoad(callback) {
427	// 注意我的图片类名都是cover,因为我只需要处理cover。其它图片可以不管。
428	// 查找所有封面图,迭代处理
429	$('.resize_img').each(function () {
430		// 找到为0就将isLoad设为false,并退出each
431		if (this.height === 0) {
432			isLoad = false;
433			return false;
434		}
435	});
436	// 为true,没有发现为0的。加载完毕
437	if (isLoad) {
438		clearTimeout(t_img); // 清除定时器
439		// 回调函数
440		callback();
441		// 为false,因为找到了没有加载完成的图,将调用定时器递归
442	} else {
443		isLoad = true;
444		t_img = setTimeout(function () {
445			isImgLoad(callback); // 递归扫描
446		}, 500); // 我这里设置的是500毫秒就扫描一次,可以自己调整
447	}
448}
449$(".search_btn").click(function () {
450	$(".search_text").slideToggle();
451});
452$(".close_search").click(function () {
453	$(".search_text").hide();
454});
455//中英文下拉跳转					
456function mbar(sobj) {
457	var docurl = sobj.options[sobj.selectedIndex].value;
458	if (docurl != "") {
459		open(docurl, '_blank');
460		sobj.selectedIndex = 0;
461		sobj.blur();
462	}
463} 
464$('.select a').each(function () {
465	var lang = $(this).text().trim();
466	if (lang == "ENG" || lang == "en") {
467		$(this).addClass('on');
468	}
469})

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.