PageSourceSearch

https://hilitetex.com/static/js/common.js

js hilitetex.com collected 2026-10-08 08:26:27 UTC 6,967 bytes, 387 lines download raw bytes

1$(document).ready(function() {
2
3	'use strict';
4
5	/*  */
6
7 // $('#header_s').load('header.html');
8 //    $('#footer').load('footer.html');
9/*  */
10	// if ($(window).width() <= 1000) {
11
12	// 	$('#cssmenu ul li a').click(function() {
13
14	// 		$('#cssmenu ul').hide().removeClass('open');
15
16	// 		$('#cssmenu #menu-button').removeClass('menu-opened');
17
18	// 	});
19
20	// }
21
22	/*  */
23
24	const rocket_wrapper = $('.g-back');
25
26	let top = $(document).scrollTop();
27
28	if (top != 0) {
29
30		rocket_wrapper.css('opacity', 1);
31
32	}
33
34	$(window).scroll(function() {
35
36		let top = $(document).scrollTop();
37
38		if (top == 0) {
39
40			rocket_wrapper.css('opacity', 0);
41
42			rocket_wrapper.hide();
43
44			rocket_wrapper.css('transform', 'translate3d(0, 0, 0)');
45
46		} else {
47
48			rocket_wrapper.show();
49
50			rocket_wrapper.css('opacity', 1);
51
52		}
53
54	});
55
56
57
58	$('#back').on('click', function() {
59
60		const screenHight = window.screen.height / 16;
61
62
63
64		rocket_wrapper.css('transform', 'translate3d(0, -' + screenHight + 'rem, 0)');
65
66		$('html,body').animate(
67
68			{
69
70				scrollTop: 0,
71
72			},
73
74			1000
75
76		);
77
78	});
79
80});
81
82$(function() {
83
84	//木瓜
85
86	var w = $(window).width();
87
88	var pc = w > 768;
89
90	// 获取导航高度,防止抖动
91
92	var head1 = $('.g-top').outerHeight();
93
94	var head2 = $('.g-header').outerHeight();
95
96	$('body').attr('style', '--head1:' + head1 + 'px;' + '--head2:' + head2 + 'px;' + '--headHeight:' + (head1 +
97		head2) + 'px;');
98
99
100
101	// lazyLoad
102
103	var w = $(window).width();
104
105	function loadImgs() {
106
107		const lazyImages = document.querySelectorAll('.lazy[data-src]');
108
109		lazyImages.forEach(function(img) {
110
111			if (img.getBoundingClientRect().top - 400 < window.innerHeight && img.getAttribute(
112					'data-src')) {
113
114				img.setAttribute('src', img.getAttribute('data-src'));
115
116				img.removeAttribute('data-src');
117
118			}
119
120		});
121
122	}
123
124
125
126	window.addEventListener('scroll', throttle(loadImgs, 200));
127
128	window.addEventListener('resize', throttle(loadImgs, 200));
129
130	loadImgs();
131
132	//
133
134	scrollClass();
135
136	function scrollClass() {
137
138		var scrollTop = 0;
139
140		$(document).on('mousewheel', function(event) {
141
142			var delta = event.originalEvent.deltaY || -event.originalEvent.detail;
143
144			if (delta > 0 && scrollTop > 10) {
145
146				$('body').addClass('isback');
147
148			} else {
149
150				$('body').removeClass('isback');
151
152			}
153
154		});
155
156		$(document).on('scroll', function() {
157
158			scrollTop = $(this).scrollTop();
159
160
161
162			if (scrollTop > this.prevScrollTop) {
163
164				$('body').addClass('isback');
165
166			} else {
167
168				$('body').removeClass('isback');
169
170			}
171
172
173
174			if (scrollTop > 10) {
175
176				$('body').addClass('scroll');
177
178			} else {
179
180				$('body').removeClass('scroll');
181
182			}
183
184			this.prevScrollTop = scrollTop <= 0 ? 0 : scrollTop;
185
186		});
187
188	}
189
190	// 节流
191
192	function throttle(fn, limit) {
193
194		let lastCall = 0;
195
196		return function(...args) {
197
198			const now = new Date().getTime();
199
200			if (now - lastCall >= limit) {
201
202				lastCall = now;
203
204				return fn.apply(this, args);
205
206			}
207
208		};
209
210	}
211
212	initWow(w);
213
214	function initWow(w) {
215
216		if (typeof WOW != 'function') {
217
218			return;
219
220		}
221
222		var vh = w > 768 ? 150 : 0;
223
224		if (!/msie [6|7|8|9]/i.test(navigator.userAgent)) {
225
226			new WOW({
227
228				offset: vh,
229
230				callback: function(box) {
231
232					$(box).addClass('wowShow');
233
234				},
235
236			}).init();
237
238		}
239
240
241
242		// $(window).resize(function () {
243
244		// 	new WOW({
245
246		// 		offset: vh,
247
248		// 		callback: function (box) {},
249
250		// 	}).init();
251
252		// });
253
254	}
255
256	//
257
258//	initLenis();
259
260	function initLenis() {
261
262		if (typeof Lenis == 'function') {
263
264			const lenis = new Lenis({
265
266				lerp: 0.1,
267
268				wheelMultiplier: 0.7,
269
270				infinite: false,
271
272				gestureOrientation: 'vertical',
273
274				normalizeWheel: false,
275
276				smoothTouch: false,
277
278				syncTouchLerp: 1,
279
280				touchMultiplier: 0.1,
281
282				autoResize: true,
283
284
285
286				prevent: (node) => {
287
288					return node.classList.contains('gdt');
289
290				},
291
292			});
293
294			lenis.on('scroll', (e) => {});
295
296			function raf(time) {
297
298				lenis.raf(time);
299
300				requestAnimationFrame(raf);
301
302			}
303
304			requestAnimationFrame(raf);
305
306
307
308			const images = document.querySelectorAll('img');
309
310			images.forEach((img) => {
311
312				img.addEventListener('load', () => {
313
314					lenis.resize();
315
316				});
317
318			});
319
320		}
321
322	}
323/*  */
324
325// const $scrollText = $('#scrollText');
326//       const text = $scrollText.text();
327//       $scrollText.html(''); // 清空内容
328
329//       // 将每个字符包裹在 <span> 中
330//       const letters = text.split('');
331//       letters.forEach((letter, index) => {
332//         const span = $('<span>').text(letter === ' ' ? ' ' : letter); // 处理空格
333//         $scrollText.append(span);
334//       });
335
336//       const $letterSpans = $scrollText.find('span');
337//       const totalLetters = $letterSpans.length;
338//       const scrollTextOffset = $scrollText.offset().top;
339//       const windowHeight = $(window).height();
340
341//       // 逐字显示动画
342//       // function revealLetters() {
343//       //   $letterSpans.each(function(index) {
344//       //     const $span = $(this);
345//       //     setTimeout(() => {
346//       //       $span.addClass('visible');
347//       //     }, index * 50); // 每个字母延迟 50ms
348//       //   });
349//       // }
350
351//       // 滚动触发颜色变化
352//       $(window).scroll(function() {
353//         const scrollTop = $(this).scrollTop();
354//         const scrollBottom = scrollTop + windowHeight;
355
356//         if (scrollBottom > scrollTextOffset && scrollTop < scrollTextOffset + $scrollText.height()) {
357//           const scrollProgress = (scrollBottom - scrollTextOffset) / ($scrollText.height() + windowHeight);
358//           const lettersToChange = Math.floor(scrollProgress * totalLetters);
359
360//           $letterSpans.each(function(index) {
361//             if (index < lettersToChange) {
362//               $(this).addClass('visible');
363//             } else {
364//               $(this).removeClass('visible');
365//             }
366//           });
367//         } else if (scrollTop >= scrollTextOffset + $scrollText.height()) {
368//           $letterSpans.addClass('visible');
369//         } else if (scrollBottom <= scrollTextOffset) {
370//           $letterSpans.removeClass('visible');
371//         }
372//       });
373
374//       // 使用 IntersectionObserver 监听元素是否进入视口
375//       const observer = new IntersectionObserver((entries) => {
376//         entries.forEach(entry => {
377//           if (entry.isIntersecting) {
378//             revealLetters(); // 触发逐字显示动画
379//             observer.unobserve($scrollText[0]); // 停止监听
380//           }
381//         });
382//       }, { threshold: 0.5 }); // 当元素 50% 进入视口时触发
383
384//       observer.observe($scrollText[0]);
385	  //数字滚动
386 
387});

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.