PageSourceSearch

https://www.gimhae.go.kr/minsaeng/_res/fund/share/js/script_scroll1section1.js

js gimhae.go.kr collected 2026-10-02 17:03:14 UTC 4,961 bytes, 164 lines download raw bytes

1/**
2 * @File Name : script_scroll1section1.js
3 * @Description : jQuery Code. 스크롤 섹션.
4 * @Modification Information
5 * <pre>
6 * 수정일 | 수정자 | 수정내용
7 * 2016.11.03 | 문영신 | 최초 등록
8 * 2016.11.30 | 문영신 | 요구반영. 결함개선. 고도화.
9 * 2017.03.24 | 문영신 | 파일명 변경. jq_scroll1section1.js 를 script_scroll1section1.js 로
10 * 2018.03.26 | 문영신 | 콘텐츠 맞춤 setoff 적용
11 * 2018.07.12 | 문영신 | $nav1top1 변경, $nav1top2 추가
12 * 2020.01.30 | 문영신 | //setoff = -$head.height();
13 * 2020.02.05 | 문영신 | 스크롤. 해당 위치로 가면 addClass
14 * </pre>
15 * @author 웹표준화실 문영신
16 * @since 2016.10.26
17 *
18 * @Copyright (C) IACTS.CO.KR All rights reserved.
19 */
20
21/* Table of contents )) ☆ 코드 변하면 목차 갱신하세요.
22************************************************************
23Var --
24	변수 초기화
25Event --
26	마우스휠
27메인UX연결
28	$선택객체
29	동작연결
30Function --
31	smoothScrollToHash() // 섹션내비.동작
32	smoothScrollTop() // 부드러운 세로 스크롤
33즉시실행 --
34
35************************************************************
36 */
37
38/** ◇◆◇◆◇◆ (function(){})(); 20161024. 20161130. MoonYoungshin
39 */
40//(function(){ // 20161130. 즉시 실행 익명 함수 사용말자! 여기 함수들을 전역으로 사용하기 위해서!
41
42	var setoff = 0, // 상쇄값 최종 상계
43		do1 = {}; // 동작정의
44
45
46	/** ◇◆  마우스휠. 20160721. MoonYoungshin
47	 */
48	$(function(){
49		$("html, body").on('mousewheel DOMMouseScroll', function(e) {
50			var e = e.originalEvent,
51				delta = 0;
52				//console.log(e);
53			if (e.detail) { // [FF]
54				delta = e.detail * -28; // [CR][IE]과 동일하게 계상
55				//console.log('detail: '+ delta);
56			}else{ // [CR][IE]
57				delta = e.wheelDelta;
58				//console.log('wheelDelta: '+ delta);
59			}
60		});
61	});
62
63
64
65	/* ◇◆ Call Functions, Plugins ◇◆◇◆◇◆ */
66
67	$(function(){ // 20161024~. 20180712
68		
69		var nowScrollTop = 0; // $(window).scrollTop() 담는거
70
71		var $nav1a = $('.mousewheel1[class*="scroll1"]'), // 현재 페이지 섹션으로 가기
72			$nav1top1 = $('#gotop1'), // 현재 페이지 상단으로 가기
73			$nav1top2 = $('#gotop2'), // 현재 페이지 상단으로 
74			$nav1bottom1 = $('#gobottom1'), // 현재 페이지 상단으로 가기
75			$head = $('#head'); // 상단 fixed 요소
76
77		// 20200130
78		//setoff = -$head.height();
79
80
81		/** ◇◆ 이벤트연결. 20180712. MoonYoungshin
82		 */
83		$nav1a.each(function(index, element){
84			// element == this
85			$(this).on('click', function(e){
86				e.preventDefault();
87				smoothScrollToHash($(this), setoff);
88			});
89		});
90
91		$nav1top1.on('click', function(e){ // 맨 위로 가기
92			e.preventDefault();
93			smoothScrollTop(0);
94		});
95
96		$nav1top2.on('click', function(e){ // 맨 위로 가기
97			e.preventDefault();
98			smoothScrollTop(0);
99		});
100
101		$nav1bottom1.each(function(index, element){
102			// element == this
103			$(this).on('click', function(e){
104				e.preventDefault();
105				smoothScrollToHash($(this), setoff);
106			});
107		});
108
109
110		/** ◇◆ 스크롤. 해당 위치로 가면 addClass. 20200205. MoonYoungshin
111		 */
112		(function(){
113
114			$(window).on('scroll load resize', function(e){
115				nowScrollTop = $(window).scrollTop();
116				//$test.html(nowScrollTop);
117				if( nowScrollTop > $head.height() ){
118					$head.addClass('scroll-top-gt-this'); // 헤더 항상 보이게
119					$nav1top1.addClass("on");
120					$nav1bottom1.addClass("on");
121				}else{
122					$head.removeClass('scroll-top-gt-this');
123					$nav1top1.removeClass("on");
124					$nav1bottom1.removeClass("on");
125				}
126			});
127
128		})();
129
130
131	});
132
133
134	/* ◇◆ Function ◇◆◇◆◇◆ */
135
136
137	/** ◇◆ 섹션내비.동작. 20160725. MoonYoungshin
138	 */
139	function smoothScrollToHash($this, setoff){ // (제이쿼리객체, 상쇄값)
140		this_hash = $this[0].hash; // = $this.attr('href');
141		//console.log(this_hash);
142		this_hash_top = $(this_hash).offset().top;
143		smoothScrollTop( this_hash_top, setoff ); // setoff 단위 없이 정숫값
144	}
145
146
147	/** ◇◆ 부드러운 세로 스크롤. 20160725. MoonYoungshin
148	 */
149	function smoothScrollTop(end_top, setoff){ // (이동할곳, 상쇄값)
150		(setoff)? setoff: setoff = 0;
151		$('html, body').stop().animate({ // $('html, body').animate() ☆[호환]OK!
152			//scrollTop: end_top // end_top 이동은 여기서 하고.. 끝나면 상쇄값 이동 시작하려는거
153			scrollTop: end_top + setoff // 상쇄 합침
154		}, 400, 'swing', function(){
155			// 아래처럼 2번 동작하는 거는 어지러워 주석처리하고 상쇄값 합쳐서 1번에 동작시킴.
156			//$('html, body').stop().animate({
157			//	scrollTop: $(document).scrollTop() + setoff
158			//}, 200, 'swing', function(){});
159		});
160	}
161
162
163//})();
164/** /◇◆◇◆◇◆ (function(){})(); */

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.