PageSourceSearch

https://www.haegin.kr/js/smoothScroll.js?ver=260924075308

js haegin.kr collected 2026-09-24 10:53:29 UTC 1,756 bytes, 73 lines download raw bytes

1function init(){
2	new SmoothScroll(document,90,15)
3}
4function SmoothScroll(target, speed, smooth) {
5	if (target === document)
6			target = (document.scrollingElement 
7						|| document.documentElement 
8						|| document.body.parentNode 
9						|| document.body);
10
11	var moving = false;
12	var pos = target.scrollTop;
13	var frame = target === document.body && document.documentElement ? document.documentElement : target;
14
15	target.addEventListener('wheel', scrolled, { passive: false });
16
17	function scrolled(e) {
18			// .hd_pops 요소에서는 기본 스크롤 유지
19			if (e.target.closest('.hd_pops')) {
20					return;
21			}
22
23			e.preventDefault(); // 기본 스크롤 동작 차단
24
25			var delta = normalizeWheelDelta(e);
26
27			pos += -delta * speed;
28			pos = Math.max(0, Math.min(pos, target.scrollHeight - frame.clientHeight));
29
30			if (!moving) update();
31	}
32
33	function normalizeWheelDelta(e) {
34			if (e.detail) {
35					if (e.wheelDelta)
36							return e.wheelDelta / e.detail / 40 * (e.detail > 0 ? 1 : -1);
37					else
38							return -e.detail / 3;
39			} else {
40					return e.wheelDelta / 120;
41			}
42	}
43
44	function update() {
45			moving = true;
46			var delta = (pos - target.scrollTop) / smooth;
47			target.scrollTop += delta;
48
49			if (Math.abs(delta) > 0.5)
50					requestFrame(update);
51			else
52					moving = false;
53	}
54
55	var requestFrame = (function() {
56			return window.requestAnimationFrame ||
57					window.webkitRequestAnimationFrame ||
58					window.mozRequestAnimationFrame ||
59					window.oRequestAnimationFrame ||
60					window.msRequestAnimationFrame ||
61					function(func) {
62							window.setTimeout(func, 1000 / 50);
63					};
64	})();
65}
66
67
68init();
69
70$(document).on("click",".applyBtn.totop",function(){
71	$( 'html, body' ).animate( { scrollTop : 0 }, 400 );
72	return false;
73});

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.