PageSourceSearch

https://www.bit.edu.cn/js/xwwgb20190115/script20191105.js

js bit.edu.cn collected 2026-10-02 09:49:05 UTC 7,707 bytes, 237 lines download raw bytes

1(function () {
2//定义页面参数
3var page ={
4	render: function () {
5		//垂直导航下拉
6		this.verticalNav();
7		//侧边导航栏固定
8		this.asideNavFix();
9		//手机端导航切换
10		this.mobileNav();
11		//置顶gotop
12		this.goTop();
13		//拖拽移动
14		this.moveDrag();
15	},
16	//垂直导航下拉
17	verticalNav: function () {
18		var oNav = $('#nav');
19		var aLi = oNav.find('li');
20		aLi.hover(function (){
21		       $(this).addClass('on');
22		       $(this).find('.v-arrow').toggleClass('icon-previewright icon-arrow3')
23			},function (){
24		      $(this).removeClass('on');
25		      if($(this).children().hasClass('v-subNav')){
26		       	$(this).find('.v-arrow').toggleClass('icon-previewright icon-arrow3')
27		      }
28			})
29		
30	},
31	
32	
33	//手机端导航切换
34	mobileNav: function (){
35		$('.mobile-header-icon').click(function(){
36			$(this).toggleClass('icon-menu icon-guanbi')
37			$('.mobile-main').fadeToggle(500)
38			$('body').toggleClass('nav-open');
39
40		})
41		var mNav = $('.mobile-nav');
42		var mLi = mNav.find('li');
43		mLi.find('.v-arrow').click(function(){
44				$(this).parents('li:first').toggleClass('on');
45				if($(this).parents('li:first').hasClass('on')){
46					$(this).addClass('icon-arrow3')
47					$(this).removeClass('icon-previewright')
48					$(this).next('.mobile-subNav').slideDown()
49					
50				}else{
51					$(this).addClass('icon-previewright')
52					$(this).removeClass('icon-arrow3');
53					$(this).next('.mobile-subNav').slideUp()
54				}
55			})
56	},
57	//侧边导航栏固定
58	asideNavFix : function (){
59		var asideHeight = $(".vertical-wrap-nav").height()
60		var iWSon =document.documentElement.clientWidth;
61		var clientHeight = document.documentElement.clientHeight;
62		//var vLogoHeight =$('.v-logo').outerHeight();
63		if(iWSon >1024){
64			$(window).scroll(function(){
65				var asideHeight = $(".vertical-wrap-nav").height()
66				var conHeight = $(".mode01").height();
67				var headerHeight =$('.wrap-header').height();
68				var wrapHeight = headerHeight + conHeight
69				conHeight = conHeight - asideHeight;
70				var scrollTop = $(window).scrollTop();
71				 if(scrollTop < 163){
72				 	$('.vertical-wrap-nav').removeClass('fixTop');
73				 }else{
74				 	$('.vertical-wrap-nav').addClass('fixTop');
75
76				 }
77				 if(scrollTop > conHeight){
78				 		$('.vertical-wrap-nav').removeClass('fixTop');
79				 		$('.vertical-wrap-nav').addClass('fixBottom');
80				 }else{
81				 	$('.vertical-wrap-nav').removeClass('fixBottom');
82				 }
83			})	 
84		}
85	},
86	//置顶gotop
87	goTop: function(){
88		$('.goTop').click(function(){
89			$('body,html').stop().animate({scrollTop:0});
90			return false;
91		});
92	},
93	//拖拽移动
94	moveDrag: function() {
95	    var isMove = false;
96	    var X, Y;
97	    var left, top;
98	    $(".drag" ).bind('mousedown', function (e) {
99	        isMove = true;
100	        X = e.pageX - parseInt($(".drag").css("left"));
101	        Y = e.pageY - parseInt($(".drag").css("top"));
102	    })
103	    $(".drag").bind('touchstart', function (e) {
104	        isMove = true;
105	        X = e.originalEvent.touches[0].clientX - parseInt($(".drag").css("left"));
106	        Y = e.originalEvent.touches[0].clientY - parseInt($(".drag").css("top"));
107	    })
108	    $(document).bind('mousemove', function (e) {
109	        if (isMove) {
110	            left = e.pageX - X;
111	            top = e.pageY - Y;
112	            if (left < 0) {
113	                left = 1
114	            }
115	            if (top < 0) {
116	                top = 1
117	            }
118	            if (left > $(window).width() - $(".drag").width()) {
119	                left = $(window).width() - $(".drag").width() - 2
120	            }
121	            if (top > $(window).height() - $(".drag").height()) {
122	                top = $(window).height() - $(".drag").height() - 2
123	            }
124	            $(".drag").css({left: left, top: top});
125	        }
126	    })
127	    $(document).bind('touchmove', function (e) {
128	        if (isMove) {
129	            left = e.originalEvent.touches[0].clientX - X;
130	            top = e.originalEvent.touches[0].clientY - Y;
131	            if (left < 0) {
132	                left = 2
133	            }
134	            if (top < 0) {
135	                top = 2
136	            }
137	            if (left > $(window).width() - $(".drag").width()) {
138	                left = $(window).width() - $(".drag").width() - 2
139	            }
140	            if (top > $(window).height() - $(".drag").height()) {
141	                top = $(window).height() - $(".drag").height() - 2
142	            }
143	            $(".drag").css({left: left, top: top});
144	        }
145	    })
146	    $(document).bind('mouseup', 'touchend', function (e) {
147	        isMove = false;
148	    })
149	}
150
151}
152// 渲染页面
153page.render();
154
155var resizeTimer = null;
156$(window).bind('resize', function (){
157    if (resizeTimer) clearTimeout(resizeTimer);
158    resizeTimer = setTimeout(function(){
159          // page.render('verticalNav');
160			// page.render('asideNavFix');
161		logoResize()
162    } ,0);
163});
164})();
165logoResize()
166function logoResize(){
167    var sWSon = document.documentElement.clientWidth;
168    if(sWSon<=380 ){
169    	$('.logo_01').find('image').attr({width:150,height:35})
170        $('.logo_01').find('svg').attr({width:150,height:35}) 
171        $('.logo_02').find('image').attr({width:55,height:18})
172        $('.logo_02').find('svg').attr({width:55,height:18}) 
173        $('.logo_03').find('image').attr({width:74,height:18})
174        $('.logo_03').find('svg').attr({width:74,height:18}) 
175    }else if(sWSon<=998 & sWSon > 380){
176    	$('.logo_01').find('image').attr({width:200,height:46})
177        $('.logo_01').find('svg').attr({width:200,height:46}) 
178        $('.logo_02').find('image').attr({width:80,height:26})
179        $('.logo_02').find('svg').attr({width:80,height:26})
180       $('.logo_03').find('image').attr({width:95,height:23})
181       $('.logo_03').find('svg').attr({width:95,height:23})
182    }else{
183    	$('.logo_01').find('image').attr({width:270,height:62})
184      $('.logo_01').find('svg').attr({width:270,height:62}) 
185      $('.logo_02').find('image').attr({width:105,height:34})
186      $('.logo_02').find('svg').attr({width:105,height:34}) 
187      $('.logo_03').find('image').attr({width:140,height:34})
188      $('.logo_03').find('svg').attr({width:140,height:34}) 
189    }
190    
191}
192
193
194//分页下拉框跳转方法
195function pageSelect(){
196  console.log($('.pageSelect').length)
197  if($('.pageSelect').length!=0){
198    $('.pageSelect').select2({});
199                
200    $("#select21").on("change",function(){
201      window.location.href=$(this).val()
202    })
203    $("#select22").on("change",function(){
204      var $thval=$(this).val()
205      if($thval=="") return false;
206      //value 索引从0开始
207       $(".camel-list .list").eq($thval).find(".demo-img:first").click();
208    })
209  }
210}
211
212//文章页侧边栏固定
213function asideFix(){
214	var sWSon = document.documentElement.clientWidth;
215	if(sWSon > 998){
216		$(window).scroll(function(){
217			var scrollTop = $(window).scrollTop();
218			var asideHeight = $(".sub_aside2").height();
219			var rtHeight = $('.pageArticle .rt').height();
220			var lfHeight =  $('.pageArticle .lf').height();
221		    var pageArticleHeight = $(".pageArticle").height();
222		  conHeight = pageArticleHeight - asideHeight;
223			 if(lfHeight > rtHeight && scrollTop >= rtHeight){
224			 	$('.sub_aside2').addClass('fixTop');
225			 }else{
226			 	$('.sub_aside2').removeClass('fixTop');
227			 }
228			 if(lfHeight > rtHeight && scrollTop > conHeight){
229			 		$('.sub_aside2').removeClass('fixTop');
230			 		$('.sub_aside2').addClass('fixBottom');
231			 }else{
232			 	$('.sub_aside2').removeClass('fixBottom');
233			 }
234		})
235	}
236	
237}

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.