PageSourceSearch

https://radionode365.com/js/nav.js

js radionode365.com collected 2026-10-09 22:41:25 UTC 6,533 bytes, 212 lines download raw bytes

1/* *******************************************************
2 * filename : nav.js
3 * description : 네비게이션 및 사이드바 on 등 메뉴에 관련된 JS
4 * date : 2020-11-25
5******************************************************** */
6
7var $snb = $(".snb");
8var $snbMenu = $(".cm-top-menu");
9// PC
10var $gnb = $("#gnb");
11var $gnbList = $("#gnb > ul");
12var $gnb_dep1 = $("#gnb > ul > li");
13var $gnb_dep2 = $("#gnb > ul > li .gnb-2dep");
14var $gnbBg = $('.gnb-overlay-bg');
15// 모바일
16var $menuBtn = $("#header .nav-open-btn");
17var $gnbM = $("#gnbM");
18var $gnbMList = $gnbM.find("#navigation").children("li");
19var $gnbMBg = $('.gnb-overlay-bg-m');
20var menuState = false;
21
22// 모바일 gnb열린 후 창 크게했을때 스크롤바 생성
23$(window).resize(function  () {
24	if ( menuState ) {
25		if ( getWindowWidth() > tabletWidth ) {
26			$("body").css({'height':'auto', 'overflow':'auto'});
27		}
28	}
29});
30
31/* *********************** PC NAV ************************ */
32// gnb 전체메뉴
33function gnb_total_on () {
34	$gnbList.children("li").children("a").on("mouseenter focus",function  () {
35		if (!($gnb.is(".open"))) {
36			$("#gnb").addClass("open");
37			$gnbBg.stop().fadeIn();
38		}
39	})
40
41	$gnbList.on("mouseleave",gnb_return);
42	$gnbList.find("a").last().on("focusout",gnb_return);
43	
44	function gnb_return () {
45		$("#gnb").removeClass("open");
46		$gnbBg.hide();
47		if ( dep1 > 0 && dep2 ) {
48			$gnbList.children("li").eq(dep1-1).addClass("active");
49		}
50	}
51}
52
53// gnb 각각메뉴
54function gnb_each_on () {
55	$gnbList.children("li").children("a").on("mouseenter focus",function  () {
56		$gnbList.children("li").removeClass("on").children(".gnb-2dep").removeClass("open"); //.hide();
57		$(this).parent("li").addClass("on").children(".gnb-2dep").stop().addClass("open"); //.slideDown(500);
58	})
59
60	$gnbList.children("li").on("mouseleave",gnb_return);
61	$gnbList.find("a").last().on("focusout",gnb_return);
62	
63	function gnb_return () {
64		// if (!$gnb.find('*').is(':animated')) {
65			$gnbList.children("li").removeClass("on").children(".gnb-2dep").removeClass("open"); //.hide();
66		// }
67		if ( dep1 > 0 && dep2 ) {
68			$gnbList.children("li").eq(dep1-1).addClass("active");
69		}
70	}
71}
72
73$(document).ready(function  () {
74	//  gnb 메뉴열기
75	if ( $gnb.is(".total-menu") ) {
76		gnb_total_on();
77	}else if ( $gnb.is(".each-menu") ) {
78		gnb_each_on();
79	}
80
81	// gnb 2차 메뉴에 마우스 올렸을때 대메뉴 on
82	$gnb_dep2.hover(function(){
83		$(this).parent("li").addClass("on");
84	},function  () {
85		$gnb_dep1.removeClass("on");
86	});
87});
88
89
90/* *********************** MOBILE NAV ************************ */
91//  메뉴열기
92function menuOpen () {
93	menuState = true;
94	$menuBtn.addClass("active");
95	$gnbM.addClass("open");
96	$gnbMBg.fadeIn();
97	$(".translate-select-wrap").addClass("on");
98	$("body").css({'height':$(window).height(), 'overflow':'hidden'});
99}
100// 메뉴닫기
101function menuClose () {
102	menuState = false;
103	$menuBtn.removeClass("active");
104	$gnbM.removeClass("open");
105	$gnbMBg.hide();
106	$(".translate-select-wrap").removeClass("on");
107	$("body").css({'height':'auto', 'overflow':'auto'});
108}
109
110$(document).ready(function  () {
111	// GNB MOBILE OPEN
112	$menuBtn.click(function  () {
113		if ( menuState ) {
114			menuClose();
115		}else {
116			menuOpen();
117		}
118		return false;
119	});
120	$gnbMBg.click(function  () {
121		menuClose();
122	});
123	// GNB MOBILE 2DEPTH 클래스 붙이기
124	$("#navigation > li:has('.gnb-2dep')").addClass("has-2dep");
125
126	//  GNB MOBILE 2DEPTH 오픈
127	$("#navigation > li:has('.gnb-2dep')").children("a").click(function(event){
128		/* 2dep가 열려있을때 */		
129		if ( $(this).parent("li").hasClass("active") ){
130			$(this).parent("li").removeClass("active");
131			$(this).children(".open-icon").hide();
132			$(this).children(".close-icon").show();
133			$(this).siblings(".gnb-2dep").slideUp(400);					
134		}
135		/* 2dep가 닫혀있을때 */ 
136		else{	  
137			$("#navigation > li").has(".gnb-2dep").each(function() {
138				if ( $(this).hasClass("active") ){
139					$(this).removeClass("active");
140					$(this).find(".open-icon").hide();
141					$(this).find(".close-icon").show();
142					$(this).children(".gnb-2dep").slideUp(400);
143				}
144			});	
145			$(this).parent("li").addClass("active");
146			$(this).children(".close-icon").hide();
147			$(this).children(".open-icon").show();
148			$(this).siblings(".gnb-2dep").slideDown(400);
149		}
150		return false;
151	});
152
153	// 해당페이지의 GNB 모바일 2depth 열기 & ON
154	if ( dep1> 0 && dep2> 0 ) {
155		$("#navigation > li").eq(dep1-1).addClass("active").children(".gnb-2dep").show().children("li").eq(dep2-1).addClass("on");
156	}
157
158	//  회원메뉴가 있는 full style  메뉴
159	if ( ( $(".gnb-style-full").length > 0 ) && ( $(".member-menu-box").length > 0 ) ) {
160		$(".gnb-style-full").addClass("gnb-style-full-member");
161	}
162});
163
164
165/* *********************** Sub 공통 ************************ */
166// 이전페이지,다음페이지 링크걸기 ( 2depth 이동 )
167function checkPrevNextLink () {
168	var $sub_prev_page_btn = $(".sub-prev-page-btn");
169	var $sub_next_page_btn = $(".sub-next-page-btn");
170	var $dep1_menu = $("#gnb > ul > li");
171	var dep1_menu_lang = $dep1_menu.length;
172
173	$sub_prev_page_btn.attr("href",$dep1_menu.eq(dep1-2).children("a").attr("href"));
174	$sub_next_page_btn.attr("href",$dep1_menu.eq(dep1).children("a").attr("href"));
175
176	$sub_prev_page_btn.find(".sub-page-name").text($dep1_menu.eq(dep1-2).children("a").text());
177	$sub_next_page_btn.find(".sub-page-name").text($dep1_menu.eq(dep1).children("a").text());
178
179	if ( dep1 == dep1_menu_lang ) {
180		$sub_next_page_btn.attr("href",$dep1_menu.eq(0).children("a").attr("href"));
181		$sub_next_page_btn.find(".sub-page-name").text($dep1_menu.eq(0).children("a").text());
182	}else if ( dep1 == 1 ) {
183		$sub_prev_page_btn.attr("href",$dep1_menu.eq(dep1_menu_lang-1).children("a").attr("href"));
184		$sub_prev_page_btn.find(".sub-page-name").text($dep1_menu.eq(dep1_menu_lang-1).children("a").text());
185	}
186}
187
188$(window).load(function  () {
189	checkPrevNextLink();
190});
191	
192$(document).ready(function  () {
193	// 서브메뉴에서 해당메뉴 on
194	if ( dep1 > 0 && dep2 > 0) {
195		$gnbList.children("li").eq(dep1-1).addClass("active");
196		$gnbMList.eq(dep1-1).addClass("on");
197		$snb.each(function  () {
198			$(this).find("li").eq(dep2-1).addClass("on");
199		});
200	}
201
202	// 서브 상단 location (1차, 2차) 하위메뉴 ON
203	$snbMenu.find(".menu-location").each(function  () {
204		// 2depth ON
205		if ( $(this).is(".location1") ) {
206			$(this).find(".location-menu-con").children("li").eq(dep1-1).addClass("on");
207		}else {
208			$(this).find(".location-menu-con").children("li").eq(dep2-1).addClass("on");
209		}
210	});
211});
212

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.