1"use strict"; 2$(function(){ 3 $(window).scroll(function(){ //ì¤í¬ë¡¤íë©´ ìë ì½ë ì¤í 4 if ($(window).width() > 767){ 5 var num = $(this).scrollTop(); // ì¤í¬ë¡¤ê° 6 if( num > $("#popupWin").outerHeight() + $("#header__inner-top").outerHeight() + $("#main_search").outerHeight()){ // ì¤í¬ë¡¤ì 36ì´ì íì ë 7 $(".header__inner-bottom").addClass("fixed_gnb"); 8 }else{ 9 $(".header__inner-bottom").removeClass("fixed_gnb"); 10 } 11 } 12 }); 13 }); 14/** ëë°ì´ì¤ íì ë°ì¤í¬í */ 15var DEVICE_TYPE_DESKTOP = "DEVICE_TYPE_DESKTOP"; 16/** ëë°ì´ì¤ íì í ë¸ë¦¿ */ 17var DEVICE_TYPE_TABLET = "DEVICE_TYPE_TABLET"; 18/** ëë°ì´ì¤ íì 모ë°ì¼ */ 19var DEVICE_TYPE_MOBILE = "DEVICE_TYPE_MOBILE"; 20 21/** ë°ì¤í¬í ìµìê° null */ 22var DEVICE_MIN_POINT_DESKTOP = null; 23/** í ë¸ë¦¿ ìµëê° 1230 */ 24var DEVICE_MAX_POINT_TABLET = 1230; 25/** 모ë°ì¼ ìµëê° 767 */ 26var DEVICE_MAX_POINT_MOBILE = 767; 27 28/** ë©ì¸ íì´ì§ ì ì© í´ëì¤ë¤ì */ 29var PAGE_CLASS_MAIN = ".main"; 30/** ìë¸ íì´ì§ ì ì© í´ëì¤ë¤ì */ 31var PAGE_CLASS_SUB = ".sub"; 32 33/** ì¤í¬ë¡¤ ë§ì ë ì¬ì©íë í´ëì¤ë¤ì */ 34var NO_SCROLL_CLASS_NAME = "no_scroll"; 35/** ì¨ê¹ììê° ììë ì¬ì©íë í´ëì¤ë¤ì */ 36var NO_VIEW_CLASS_NAME = "no_view"; 37 38/** ì ê·¼ì±ì ìí ìì±ëª */ 39var A11Y = { 40 EXPANDED: "aria-expanded" 41}; 42 43/** 커ì¤í ì´ë²¤í¸ ë¤ìì¤íì´ì¤ */ 44var EVENT = { 45 ON_CHANGE_DOM_SIZE: "EVENT_ON_CHANGE_DOM_SIZE", 46 EXPANDED_ALLMENU: "EVENT_EXPANDED_ALLMENU", 47 COLLAPSED_ALLMENU: "EVENT_COLLAPSED_ALLMENU" 48}; 49 50/** jQuery.Object window */ 51var $win = $(window); 52/** jQuery.Object document */ 53var $doc = $(document); 54/** jQuery.Object html */ 55var $html = $("html"); 56 57/** ê¸ë¡ë² ìì± */ 58 59var globalAttr = { 60 /** ì ì²´ ì¤í¬ë¡¤ì´ ë§íìëê°? */ 61 isDisablScroll: false, 62 /** ëë°ì´ì¤ íì ? ë°ì¤í¬í || í ë¸ë¦¿ || 모ë°ì¼ */ 63 deviceType: "", 64 /** íì´ì§ íì ? ë©ì¸ || ìë¸*/ 65 pageType: "" 66}; 67 68/************************************************************************************* 69 ê³µíµ ê¸°ë¥ ë° ê³µíµ ì¤ì ì ìí ê°ì²´ 70**************************************************************************************/ 71var commons = { 72 /** 73 * ê³µíµ ì¤ì 74 */ 75 init: function() { 76 this.reset(); 77 $win.on("resize.commons", $.proxy(this.reset, this)); 78 }, 79 /** 80 * ì¬ì´ì¦ê° ë³ê²½ë ë ë§ë¤ 기본ì¤ì ê°ì ë¤ì ì¸í 81 */ 82 reset: function() { 83 this.setDeviceType(); 84 this.setPageType(); 85 }, 86 /** 87 * 커ì¤í ì´ë²¤í¸ ë±ë¡ê³¼ trigger ë©ìë ì ê³µ 88 */ 89 event: (function() { 90 var events = {}; 91 92 function forEachEmitFunction(functions, eventName, eventData) { 93 for (var i = 0; i < functions.length; i++) { 94 functions[i](eventData, eventName); 95 } 96 } 97 98 return { 99 /** 100 * ì´ë²¤í¸ ë±ë¡ 101 * @param {Strign} eventName ì´ë²¤í¸ ì´ë¦ 102 * @param {Function} action ë±ë¡í ì´ë²¤í¸ í¸ë¤ë¬ 103 */ 104 listener: function(eventName, action) { 105 if (typeof action === "function") { 106 if (events[eventName] === undefined) { 107 events[eventName] = []; 108 } 109 110 events[eventName].push(action); 111 } 112 }, 113 /** 114 * ì´ë²¤í¸ ì¤í 115 * @param {Strign} eventName ì´ë²¤í¸ ì´ë¦ 116 * @param {Object} eventData ì´ë²¤í¸ ë°ì´í° 117 */ 118 trigger: function(eventName, eventData) { 119 events[eventName] && 120 forEachEmitFunction(events[eventName], eventName, eventData); 121 } 122 }; 123 })(), 124 /** 125 * íì¬ ì ì²´ ì¤í¬ë¡¤ì´ ë¹íì±íëì´ ìëì§ true/false를 ë°ííë¤. 126 */ 127 getDisablScrollStat: function() { 128 return globalAttr.isDisablScroll; 129 }, 130 /** 131 * ì ì²´ ì¤í¬ë¡¤ì íì±ííë¤. 132 */ 133 enabledScroll: function() { 134 $html.removeClass(NO_SCROLL_CLASS_NAME); 135 globalAttr.isDisablScroll = false; 136 }, 137 /** 138 * ì ì²´ ì¤í¬ë¡¤ì ë¹íì±ííë¤. 139 */ 140 disabledScroll: function() { 141 $html.addClass(NO_SCROLL_CLASS_NAME); 142 globalAttr.isDisablScroll = true; 143 }, 144 145 /** 146 * ì ì²´ ì¨ê¹ íì±ííë¤ 147 */ 148 enabledView: function() { 149 $html.removeClass(NO_VIEW_CLASS_NAME); 150 }, 151 /** 152 * ì ì²´ ì¨ê¹ ë¹íì±ííë¤ 153 */ 154 disabledView: function() { 155 $html.addClass(NO_VIEW_CLASS_NAME); 156 }, 157 /** 158 * íì¬ ëë°ì´ì¤ íì ì ë°ííë¤. 159 * @return {String} DEVICE_TYPE_DESKTOP || DEVICE_TYPE_TABLET || DEVICE_TYPE_MOBILE 160 */ 161 getDeviceType: function() { 162 return globalAttr.deviceType; 163 }, 164 /** 165 * ëë°ì´ì¤ íì ì ì²´í¬íì¬ ëª¨ë°ì¼/í ë¸ë¦¿/ë°ì¤í¬í 3ê°ì§ë¡ 구ë¶íì¬ í´ë¹ê°ì 166 * globalAttr.deviceTypeì ì ì¥íë¤. 167 */ 168 setDeviceType: function() { 169 var windowWidth = $win.outerWidth(); 170 171 if (windowWidth <= DEVICE_MAX_POINT_MOBILE) { 172 globalAttr.deviceType = DEVICE_TYPE_MOBILE; 173 } else if (windowWidth <= DEVICE_MAX_POINT_TABLET) { 174 globalAttr.deviceType = DEVICE_TYPE_TABLET; 175 } else { 176 globalAttr.deviceType = DEVICE_TYPE_DESKTOP; 177 } 178 }, 179 /** 180 * íì¬ íì´ì§ íì ì 구íë¤. 181 * @reutn {String} PAGE_CLASS_MAIN || PAGE_CLASS_SUB 182 */ 183 getPageType: function() { 184 return globalAttr.pageType; 185 }, 186 /** 187 * íì¬ íì´ì§ íì ì¤ì íë¤. 188 * @return {String} PAGE_CLASS_MAIN || PAGE_CLASS_SUB 189 */ 190 setPageType: function() { 191 var hasMainClassName = $html.find(PAGE_CLASS_MAIN).length; 192 193 globalAttr.pageType = hasMainClassName ? PAGE_CLASS_MAIN : PAGE_CLASS_SUB; 194 } 195}; 196 197/************************************************************************************* 198 í¤ë ê³ ì ì¤í¬ë¦½í¸ 199**************************************************************************************/ 200var stickyHeader = { 201 init: function() { 202 // íìí ê°ì²´ ì í 203 this.$popupWin = $(".banner__notice-wrap"); 204 this.$container = $(".header-wrap"); 205 this.$header = this.$container.find(".header"); 206 this.$headsearch = $(".wide-search-wrap"); 207 this.$headerBottom = this.$container.find(".header__inner-bottom"); 208 this.$headerUtility = this.$container.find(".header__utility"); 209 this.setFixedElement(); 210 this.setPhysical(); 211 this.controller(); // ì´ê¸° ë¡ëì ì¤í¬ë¡¤ìì¹ê° 0ì´ ìëì ì기ë문ì ê³ ì /ê³ ì í´ì í ì§ ì²´í¬ 212 this.deviceType = commons.getDeviceType(); 213 214 //ì´ë²¤í¸ ë°ì¸ë 215 $win.on("resize.stickyHeader", $.proxy(this.reset, this));
216 $win.on("scroll.stickyHeader", $.proxy(this.controller, this)); 217 218 //커ì¤í ì´ë²¤í¸ ë±ë¡ 219 commons.event.listener(EVENT.ON_CHANGE_DOM_SIZE, $.proxy(this.reset, this)); 220 }, 221 isChangeDeviceType: function () { 222 if (this.deviceType !== commons.getDeviceType()) { 223 this.deviceType = commons.getDeviceType(); 224 225 return true; 226 } 227 return false; 228 }, 229 /** ê³ ì ëì´ì¼ íë DOM ìì ì¤ì */ 230 setFixedElement: function() { 231 var isMainDesktop = this.isMainDesktop(); 232 233 if ($(window).width() < 767) { 234 this.$fixedElementWrapper = isMainDesktop ? this.$header : this.$container; 235 this.$fixedElement = isMainDesktop ? this.$headerBottom : this.$header; 236 } else { 237 this.$fixedElementWrapper = isMainDesktop ? this.$headsearch : this.$container; 238 this.$fixedElement = isMainDesktop ? this.$headerBottom : this.$headsearch; 239 } 240 }, 241 /** ê³ ì ì´ ììëë posY ìì¹ê°ê³¼ ê³ ì ëììë í¤ëì ì ì©ëì´ì¼íë padding ê°ì 구íë¤. */ 242 setPhysical: function() { 243 this.fixedPosY = this.$container.outerHeight() - this.$fixedElement.outerHeight() + this.$popupWin.outerHeight() + $("#main_search").outerHeight(); 244 this.bufferValue = this.$fixedElement.outerHeight(); 245 }, 246 /** íì¬ íì´ì§ê° PCííì ë©ì¸íì´ì§ ì¬ë¶ë¥¼ ë°í */ 247 isMainDesktop: function () { 248 var isMain = commons.getPageType() === PAGE_CLASS_MAIN; 249 var isMobile = commons.getDeviceType() === DEVICE_TYPE_MOBILE; 250 return isMain && !isMobile; 251 }, 252 /** íë©´ ì¬ì´ì¦ê° ë³ê²½ëììë */ 253 reset: function() { 254 if (this.isChangeDeviceType()) { 255 this.detach(); 256 } 257 258 this.setFixedElement(); 259 this.setPhysical(); 260 this.controller(); 261 }, 262 /** íì¬ ì¤í¬ë¡¤ ìì¹ê°ì íì¸íì¬ í¤ëê° ê³ ì ëì´ì¼ íëì§ ìëì§ë¥¼ ê²°ì íë¤ */ 263 controller: function() { 264 var scroll = 0; 265 var scrollTop = $win.scrollTop(); 266 if ($(window).width() < 767) { 267 scroll=0; 268 } else { 269 scroll = this.fixedPosY; 270 } 271 scrollTop > scroll? this.attach() : this.detach(); 272 }, 273 /** í¤ë를 ìë¨ì ê³ ì íë¤. */ 274 attach: function() { 275 this.$container.parents().find('.sub').addClass('sub_fixed'); 276 this.$container.parents().find('.main').addClass('main_fixed'); 277 // this.$fixedElementWrapper.css({ paddingBottom: this.bufferValue }); 278 //this.$fixedElement.css({ position: "fixed", top: 0 }); 279 //this.$fixedElement.css({ position: "fixed", top: 0, borderBottom: "1px solid #ddd"}); 280 //this.$fixedElement.addClass('is_fixed_hd'); 281 this.isAttach = false; 282 }, 283 /** ê³ ì ëì´ ìë í¤ë를 í´ì íë¤. */ 284 detach: function() { 285 this.$container.parents().find('.sub').removeClass('sub_fixed'); 286 this.$container.parents().find('.main').removeClass('main_fixed'); 287 this.$fixedElementWrapper.removeAttr("style"); 288 // this.$fixedElement.removeAttr("style"); 289 //this.$container.parents().find('.header').removeClass('is_fixed_hd'); 290 //this.$fixedElement.removeClass("is_fixed_hd"); 291 this.isAttach = false; 292 }, 293 /** 294 * ê³ ì ë í´ëê° ììì ëì´ê°ì ë°ííë¤. 295 * @public 296 */ 297 getHeaderHeight: function() { 298 return this.isAttach 299 ? this.$fixedElement.outerHeight() 300 : this.$container.outerHeight() - $win.scrollTop(); 301 }, 302 303 /** 기본 í¤ëì ê³ ì ìí */ 304 isAttach: true 305}; 306 307/************************************************************************************* 308 ìµìë¨ ë°°ë ì¤í¬ë¦½í¸ 309**************************************************************************************/ 310var noticeBanner = { 311 init: function() { 312 this.speed = 300; 313 314 // íìí ê°ì²´ ì í 315 this.$container = $(".banner__notice-wrap"); 316 this.$content = this.$container.find(".banner__content"); 317 this.$toggler = this.$container.find(".banner__controller button"); 318 319 // ë²í¼ì ì´ê¸° ê° ë³ê²½ 320 this.isExpanded ? this.expanded(0) : this.collapsed(0); 321 322 // ì´ë²¤í¸ ë°ì¸ë 323 this.$toggler.on("click", $.proxy(this.controller, this)); 324 }, 325 /** íì¬ ë°°ë ìíì ë°ë¼ ë°°ë를 ì´ê³ /ë«ìì§ ê²°ì íë¤ */ 326 controller: function(e) { 327 e.preventDefault(); 328 var isExpand = this.$toggler.attr(A11Y.EXPANDED) === "true"; 329 isExpand ? this.collapsed() : this.expanded(); 330 }, 331 /** ë°°ë를 íì¥ìí¨ë¤. */ 332 expanded: function(speed) { 333 // íë¼ë¯¸í°ë¡ ì¤í¼ë ê°ì´ ìì¼ë©´ ëí´í¸ ì¤í¼ë ì ì© 334 var speed = speed === undefined ? this.speed : 0; 335 336 // ë°°ë íì¥ 337 this.$content.stop().slideDown( 338 speed, 339 $.proxy(function() { 340 // ë°°ëê° íì¥ëê³ ì¤íí ì½ëë¤... 341 this.isExpanded = true; // íì¬ ì¶ìì¬ë¶ ë³ê²½ 342 this.$toggler.attr(A11Y.EXPANDED, true); // ë²í¼ ì리ì ìì±ê° ë³ê²½ 343 this.$content.attr("style", "display:block"); // í ê¸ë²í¼ì ì°ë¬ì ëë ì ë ì´ì í´ê²°ì© 344 //커ì¤í ì´ë²¤í¸ ì¤í 345 commons.event.trigger(EVENT.ON_CHANGE_DOM_SIZE); 346 }, this) 347 ); 348 }, 349 /** ë°°ë를 ì¶ììí¨ë¤. */ 350 collapsed: function(speed) { 351 // íë¼ë¯¸í°ë¡ ì¤í¼ë ê°ì´ ìì¼ë©´ ëí´í¸ ì¤í¼ë ì ì© 352 var speed = speed === undefined ? this.speed : 0; 353 354 // ë°°ëì¶ì 355 this.$content.stop().slideUp( 356 speed, 357 $.proxy(function() { 358 // ë°°ëê° ì¶ìëê³ ì¤íí ì½ëë¤... 359 this.isExpanded = false; // íì¬ ì¶ìì¬ë¶ ë³ê²½ 360 this.$toggler.attr(A11Y.EXPANDED, false); // ë²í¼ ì리ì ìì±ê° ë³ê²½ 361 this.$content.attr("style", "display:none"); // í ê¸ë²í¼ì ì°ë¬ì ëë ì ë ì´ì í´ê²°ì© 362 //커ì¤í ì´ë²¤í¸ ì¤í 363 commons.event.trigger(EVENT.ON_CHANGE_DOM_SIZE); 364 }, this) 365 ); 366 }, 367 368 /** 기본 ìíê° */ 369 370 isExpanded: true 371}; 372 373/************************************************************************************* 374 GNB ë©ë´ ì´ê³ /ë«ê¸° ë° ì¸í 375**************************************************************************************/ 376var gnb = { 377 init: function() { 378 this.$container = $(".header");
379 this.$gnbBackground = this.$container.find(".menu_bg"); 380 // ìëì¤ 381 this.$gnbOneDepthList = this.$container.find(".menu-gnb-depth1"); 382 this.$gnbOneDepthItems = this.$container.find(".menu-gnb-depth1__item"); 383 this.$gnbOneDepthItemsEv = this.$gnbOneDepthItems.find("a"); 384 // íì ë©ë´ 385 this.$gnbSubDepthList = this.$container.find(".menu-gnb-depth2"); 386 this.$gnbSubDepthItems = this.$container.find(".menu-gnb-depth2__item"); 387 388 // gnb ìì¡ê° 389 this.activeOneDepthClass = "gnb-depth1--active"; 390 this.activeSubDepthClass = "gnb-depth2--active"; 391 392 // gnbë©ë´ íì¥íì±í ê¸°ë¥ ë¹íì±í ì¬ë¶ 393 this.isDisabled = false; 394 // ìë¸ë©ë´ ëì´ê° ì¤ì 395 this.reset(); 396 397 /************ ì´ë²¤í¸ ë°ì¸ë ************/ 398 399 $win.on("resize.gnbResize", $.proxy(this.reset, this)); 400 /** GNBì ì²´ ë«í */ 401 this.$gnbOneDepthList.on( 402 "mouseleave focusoutside", 403 $.proxy(this.collapsed, this) 404 ); 405 /** GNBë©ë´ íì±í && ìëì¤ ë©ë´ íì±í */ 406 this.$gnbOneDepthItemsEv.on( 407 "mouseover focusin", 408 $.proxy(this.expanded, this) 409 ); 410 /*this.$gnbOneDepthItems.on( 411 "mouseover focusin", 412 $.proxy(this.expandedOn, this) 413 );*/ 414 /** ìëì¤ ë©ë´ ë¹íì±í */ 415 this.$gnbOneDepthItems.on( 416 "mouseleave focusout", 417 $.proxy(this.inactivationOneDepth, this) 418 ); 419 /** ìë¸ ë©ë´ íì±í */ 420 this.$gnbSubDepthItems.on( 421 "mouseover focusin", 422 $.proxy(this.activeSubDepth, this) 423 ); 424 /** ìë¸ ë©ë´ ë¹íì±í */ 425 this.$gnbSubDepthItems.on( 426 "mouseleave focusout", 427 $.proxy(this.inactivationSubDepth, this) 428 ); 429 430 /** 커ì¤í ì´ë²¤í¸ 리ì¤ë ë±ë¡ */ 431 commons.event.listener( 432 EVENT.EXPANDED_ALLMENU, 433 $.proxy(function() { 434 this.isDisabled = true; 435 this.collapsed(); 436 }, this) 437 ); 438 439 /** 커ì¤í ì´ë²¤í¸ 리ì¤ë ë±ë¡ */ 440 commons.event.listener( 441 EVENT.COLLAPSED_ALLMENU, 442 $.proxy(function() { 443 this.isDisabled = false; 444 }, this) 445 ); 446 }, 447 /** íë©´ì´ ë¦¬ì¬ì´ì§ ë ë ë§ë¤ íìë©ë´ ë° ë°°ê²½ ëì´ê°ì ì¤ì íë¤ */ 448 reset: function() { 449 var mexHeight = 0; 450 451 this.$gnbSubDepthList.removeAttr("style"); 452 this.$gnbSubDepthList.each(function(index, el) { 453 mexHeight = 454 mexHeight > $(el).outerHeight() ? mexHeight : $(el).outerHeight(); 455 }); 456 457 this.$gnbBackground.outerHeight(mexHeight +2); 458 this.$gnbSubDepthList.outerHeight(mexHeight); 459 }, 460 /** GNB ë©ë´ë¥¼ íì±í íë¤. */ 461 expanded: function(e) { 462 if (this.isDisabled) return; 463 464 this.activeOneDepth(e); 465 this.$gnbBackground.show(); 466 this.$gnbSubDepthList.show(); 467 this.isExpanded = true; 468 $(".header__inner-gnb").addClass("active"); 469 }, 470 expandedOn: function(e) { 471 if (this.isDisabled) return; 472 473 this.activeOneDepth(e); 474 }, 475 /** GNB ë©ë´ë¥¼ ë¹íì±í íë¤. */ 476 collapsed: function(e) { 477 this.$gnbBackground.hide(); 478 this.$gnbSubDepthList.hide(); 479 this.isExpanded = false; 480 $(".header__inner-gnb").removeClass("active"); 481 }, 482 /** ìëì¤ ë©ë´ë¥¼ íì±í íë¤ */ 483 activeOneDepth: function(e) { 484 $(e.currentTarget).closest(".menu-gnb-depth1__item").addClass(this.activeOneDepthClass); 485 }, 486 /** ìëì¤ ë©ë´ë¥¼ ë¹íì±í íë¤ */ 487 inactivationOneDepth: function(e) { 488 $(e.currentTarget).removeClass(this.activeOneDepthClass); 489 }, 490 /** ìë¸ ë©ë´ë¥¼ íì±í íë¤ */ 491 activeSubDepth: function(e) { 492 $(e.currentTarget).addClass(this.activeSubDepthClass); 493 }, 494 /** ìë¸ ë©ë´ë¥¼ ë¹íì±í íë¤ */ 495 inactivationSubDepth: function(e) { 496 $(e.currentTarget).removeClass(this.activeSubDepthClass); 497 }, 498 /** 기본 ìíê° */ 499 isExpanded: false 500}; 501 502/************************************************************************************* 503 ì ì²´ ë©ë´ ì´ê³ ë«ê¸°(with mobile) 504**************************************************************************************/ 505var allMenu = { 506 init: function() { 507 // ê¸°ë³¸ê° ì¤ì 508 this.speed = 500; // íì¥ì¶ì ìë 509 this.depthOneWrapperSelector = ".menu-all-depth1__item"; 510 this.depthOneToggleSelector = ".depth1"; // 1ëì¤ ë©ë´ ìì´í 511 this.depthOneMenuSelector = ".menu-all-depth1-category"; // 1ëì¤ ë©ë´ 512 this.subMenuSelector = "ul";
512 // 2ëì¤ ì´íì íìë©ë´ ì íì 513 this.subToggleSelector = ".menu-all-depth1-category .depth"; // 2ëì¤ ì´í íì ë©ë´í ê¸ë²í¼ 514 this.scrollInnerSelector = ".menu-all-inner--scroll.scrollbar-outer"; 515 516 // íìí ê°ì²´ ì í 517 this.$container = $(".menu-tool-wrap"); 518 this.$toggler = this.$container.find(".btn-open"); 519 this.$closeer = this.$container.find(".btn-close"); 520 this.$allMenu = this.$container.find(".menu-all-wrap"); 521 522 // ì¤í¬ë¡¤ ìì 523 this.$scrollBox = this.$container.find(".menu-all-inner--scrollbox"); 524 this.$allMenuInner = this.$container.find(".menu-all-inner"); 525 this.$allMenuTitle = this.$allMenuInner.find(".title"); 526 this.$subMenuToggler = this.$container.find(this.subToggleSelector); 527 // ì¤í¬ë¡¤ ìì ì본 DOM 528 this.originChildren = this.$scrollBox.html(); 529 this.changeMobileDevice = false; 530 531 this.reset(); 532 this.isExpanded ? this.expanded(0) : this.collapsed(0); // ë¡ëì 기 ìí 533 534 // ì´ë²¤í¸ ë°ì¸ë 535 $win.on("resize", $.proxy(this.reset, this)); 536 this.$toggler.on("click", $.proxy(this.controller, this)); 537 this.$closeer.on("click", $.proxy(this.collapsed, this)); 538 this.$allMenu.on("click",this.depthOneToggleSelector,$.proxy(this.togglerMobileDepthOneMenu, this)); 539 this.$allMenu.on("click",this.subToggleSelector,$.proxy(this.subController, this)); 540 541 //커ì¤í ì´ë²¤í¸ ë±ë¡ 542 commons.event.listener(EVENT.ON_CHANGE_DOM_SIZE, $.proxy(this.reset, this)); 543 }, 544 /** 545 * window resize / EVENT.ON_CHANGE_DOM_SIZE ì´ë²¤í¸ ë°ì ì 546 */ 547 reset: function(e, eventName) { 548 var speed = eventName === EVENT.ON_CHANGE_DOM_SIZE ? this.speed : 0; 549 550 // íì ë©ë´ 모ëê° íì±í ëì´ì¼ íëì§ ìëì§ë¥¼ ì²´í¬ 551 this.isSubAllExpanded = 552 commons.getDeviceType() === DEVICE_TYPE_DESKTOP 553 ? this.defaultStateDesktop 554 : commons.getDeviceType() === DEVICE_TYPE_TABLET 555 ? this.defaultStateTablet 556 : this.defaultStateMobile; 557 558 // 모ë°ì¼ ëë°ì´ì¤ìì ì¤í¬ë¡¤ ë° íì±í ë©ë´ ì´ê¸°í 559 if (commons.getDeviceType() === DEVICE_TYPE_MOBILE) { 560 this.removeScroller(); 561 if (!this.changeMobileDevice) { 562 this.activeMobileDepthOneMenu(0); 563 this.changeMobileDevice = true; 564 } 565 } else { 566 this.changeMobileDevice = false; 567 } 568 569 // íì ë©ë´ 모ëê° íì±í ì¬ë¶ì ë°ë¼ ì ì²´ë©ë´ íì±í ë¹íì±í. 570 this.isSubAllExpanded 571 ? this.allExpandedSubMenu(0) 572 : this.allCollapsedSubMenu(0); 573 574 // íì¥ëì´ ìì ê²½ì°ìë§ íì¥ì´ë²¤í¸ ì¤í 575 this.isExpanded && this.expanded(speed); 576 }, 577 /** 578 * í¤ë를 ì ì¸í ëë¨¸ì§ ëì´ê° === PCìì ì ì²´ë©ë´ì ëì´ê° 579 */ 580 withoutHeaderHeight: function() { 581 var windowHeight = $win.outerHeight(); 582 // stickyHeaderê°ì²´ìì ì§ì ë©ìëë¡ ë³´ì¬ì§ê³ ìë í¤ëì ëì´ê°ì ê°ì ¸ì´ 583 var headerHeight = stickyHeader.getHeaderHeight(); 584 585 return windowHeight - headerHeight; 586 }, 587 /** 588 * ì ì²´ë©ë´ë¥¼ íì¥/ì¶ìí ì§ ê²°ì íì¬ íì¥/ì¶ì ë©ìë를 í¸ì¶íë¤. 589 */ 590 controller: function(e) { 591 e.preventDefault(); 592 var isExpand = this.$toggler.attr(A11Y.EXPANDED) === "true"; 593 594 isExpand ? this.collapsed() : this.expanded(); 595 }, 596 /** 597 * ì ì²´ë©ë´ë¥¼ íëíë¤. 598 */ 599 expanded: function(speed) { 600 // ì¤í¼ë ì¤ì (íë¼ë¯¸í°ê°ì´ ìì¼ë©´ íë¼ë¯¸í° ê°ì¼ë¡ ìì¼ë©´ 기본 ì¤ì ê°ì¼ë¡) 601 var speed = speed === undefined ? this.speed : speed; 602 603 // 모ì ê° ì¤ì 604 var options = 605 commons.getDeviceType() === DEVICE_TYPE_MOBILE 606 ? { left: 0 } 607 : { height: this.withoutHeaderHeight(), opacity: 1 }; 608 609 // ì ì²´ì¤í¬ë¡¤ ë§ê¸° 610 commons.disabledScroll(); 611 612 // ë²í¼ ariaê° ì¤ì 613 this.isExpanded = true; 614 this.$toggler.attr(A11Y.EXPANDED, this.isExpanded); 615 616 // 커ì¤í ì´ë²¤í¸ í¸ë¦¬ê±° -> GNB ë©ë´ ê¸°ë¥ ì¼ìì ì§ 617 commons.event.trigger(EVENT.EXPANDED_ALLMENU, {}); 618 619 //íì¥ìí¤ê¸° 620 this.$allMenu 621 .show() 622 .stop() 623 .animate( 624 options, 625 speed, 626 $.proxy(function() { 627 /** ì´ê¸° 모ì ëëë©´... */ 628 629 /** 630 * pc/í ë¸ë¦¿ì¸ ê²½ì° ì¤í¬ë¡¤ ì ì©. 631 * 모ë°ì¼ë¡ ëì´ê°ë ìê° ìì 632 */ 633 634 if (commons.getDeviceType() === DEVICE_TYPE_MOBILE) { 635 return; 636 } 637 638 this.setScroller(); 639 }, this) 640 ); 641 642 /** pcììë ë³´ì´ì§ ìê² íë¤ */ 643 if ($(window).width() > 767){ 644 this.$allMenu.hide(); 645 } 646 }, 647 /** 648 * ì ì²´ë©ë´ë¥¼ ì¶ìíë¤. 649 */ 650 collapsed: function(speed) { 651 // ì¤í¼ë ì¤ì (íë¼ë¯¸í°ê°ì´ ìì¼ë©´ íë¼ë¯¸í° ê°
651ì¼ë¡ ìì¼ë©´ 기본 ì¤ì ê°ì¼ë¡) 652 var speed = speed === undefined ? this.speed : speed; 653 // 모ì ê° ì¤ì 654 var options = 655 commons.getDeviceType() === DEVICE_TYPE_MOBILE 656 ? { left: "-100%" } 657 : { height: 0, opacity: 0 }; 658 659 // ì ì¸ì¤í¬ë¡¤ íì±í 660 commons.enabledScroll(); 661 662 // ë²í¼ ariaê° ì¤ì 663 this.isExpanded = false; 664 this.$toggler.attr(A11Y.EXPANDED, this.isExpanded); 665 666 // 커ì¤í ì´ë²¤í¸ í¸ë¦¬ê±° -> GNB ë©ë´ ê¸°ë¥ ì¼ìì ì§í기 667 commons.event.trigger(EVENT.COLLAPSED_ALLMENU, {}); 668 669 // ë¹íì±í 모ì 670 this.$allMenu.stop().animate(options, { 671 duration: speed, 672 complete: $.proxy(function() { 673 /** ë«ê¸° 모ì ëëë©´... */ 674 // ì ì²´ë©ë´ display:none ì²ë¦¬ 675 this.$allMenu.removeAttr("style"); 676 // 기본 íì ë©ë´ìíê° ì´ë ¤ ìë ê±°ë¼ë©´ 모ë íìë©ë´ íì¥ ìëë¼ë©´ ì¶ì 677 // 2020.02.13.모ë°ì¼ê¸°ê¸° íì¬ë©ë´ íì를 ìí 주ìì²ë¦¬ 678 /*this.isSubAllExpanded 679 ? this.allExpandedSubMenu(0) 680 : this.allCollapsedSubMenu(0);*/ 681 }, this) 682 }); 683 }, 684 /** 685 * íìë©ë´ë¥¼ íì¥/ì¶ìí ì§ ê²°ì íì¬ íì¥/ì¶ì ë©ìë를 í¸ì¶íë¤. 686 */ 687 subController: function(e) { 688 var $target = $(e.currentTarget); 689 var isExpand = $target.attr(A11Y.EXPANDED); 690 691 // aria-expandedê° ìì¼ë©´ íì ë©ë´ê° ìë ê²ì¼ë¡ í¨ì를 ì¢ ë£íë¤. 692 if (isExpand === undefined) { 693 return; 694 } 695 // 기본 기ë¥ì ë§ëë¤.(ë§í¬ì´ëë§ê¸°) 696 e.preventDefault(); 697 // íì¥ì¬ë¶ì ë°ë¼ íìë©ë´ë¥¼ íì¥/ì¶ìíë¤. 698 isExpand === "true" 699 ? this.collapsedSubMenu($target) 700 : this.expandedSubMenu($target); 701 }, 702 /** 703 * íìë©ë´ë¥¼ íì¥íë¤. 704 */ 705 expandedSubMenu: function($target, speed) { 706 var speed = speed === undefined ? this.speed : speed; 707 708 // íì¥ì¶ìë íì ë©ë´ë¦¬ì¤í¸ 709 var $subMenu = $target.siblings(this.subMenuSelector); 710 711 // 기본ì íì¥ëì´ ìë ìì´í ì ì¶ììí¨ë¤. 712 !this.isSubAllExpanded && 713 this.collapsedSubMenu( 714 $target 715 .parents() 716 .siblings() 717 .find("[" + A11Y.EXPANDED + "=true]") 718 ); 719 720 // í´ë¦í 2ëì¤ ë©ë´ìì´í ì ì리ìê° ë³ê²½ 721 $target.attr(A11Y.EXPANDED, true); 722 723 // íìë©ë´ íë 724 $subMenu.stop().slideDown( 725 $.proxy(function() { 726 $subMenu.attr("style", "display:block"); 727 }, this) 728 ); 729 }, 730 /** 731 * íìë©ë´ë¥¼ ì¶ìíë¤. 732 */ 733 collapsedSubMenu: function($target, speed) { 734 if (this.isSubAllExpanded) return; 735 var speed = speed === undefined ? this.speed : speed; 736 737 // íì¥ì¶ìë íì ë©ë´ë¦¬ì¤í¸ 738 var $subMenu = $target.siblings(this.subMenuSelector); 739 740 // í´ë¦í 2ëì¤ ë©ë´ìì´í ì ì리ìê° ë³ê²½ 741 $target.attr(A11Y.EXPANDED, false); 742 743 // íìë©ë´ ì¶ì 744 $subMenu.stop().slideUp( 745 $.proxy(function() { 746 $subMenu.attr("style", "display:none"); 747 }, this) 748 ); 749 }, 750 /** 751 * 모ë íì ë©ë´ë¥¼ íì¥ìí¨ë¤. 752 */ 753 allExpandedSubMenu: function() { 754 var $subMenus = this.$subMenuToggler.siblings(this.subMenuSelector); 755 756 // íì ë©ë´ë¥¼ ë³´ì´ê³ íìë©ë´ê° ìë 2ëì¤ ìì´í ìë§ aria ìì± ì ì© 757 $subMenus 758 .show() 759 .siblings(this.$subMenuToggler) 760 .attr(A11Y.EXPANDED, true); 761 }, 762 /** 763 * 모ë íì ë©ë´ë¥¼ ì¶ììí¨ë¤. 764 */ 765 allCollapsedSubMenu: function() { 766 var $subMenus = this.$subMenuToggler.siblings(this.subMenuSelector); 767 768 // íì ë©ë´ë¥¼ ì¨ê¸°ê³ íìë©ë´ê° ìë 2ëì¤ ìì´í ìë§ aria ìì± ì ì© 769 $subMenus 770 .hide() 771 .siblings(this.$subMenuToggler) 772 .attr(A11Y.EXPANDED, false); 773 }, 774 /** 775 * 모ë°ì¼ìì ìëì¤ ë©ë´ë¥¼ í´ë¦ íìë í´ë¹ ë©ë´ë¥¼ íì±í ìí¬ì§ ë§ì§ ê²°ì íë¤ 776 */ 777 togglerMobileDepthOneMenu: function(e) { 778 var $target = $(e.target); 779 var hasNotMenu = $target.next(this.depthOneMenuSelector).length === 0; 780 var isNotMobile = commons.getDeviceType() !== DEVICE_TYPE_MOBILE; 781 var index = $target.parent().index(); 782 783 if (hasNotMenu || isNotMobile) return; 784 785 e.preventDefault(); 786 this.activeMobileDepthOneMenu(index); 787 }, 788 /** 789 * íë¼ë¯¸í°ë¡ ë°ì ì¸ë±ì¤ì ìëì¤ë©ë´ë¥¼ íì±ííë¤. 790 */ 791 activeMobileDepthOneMenu: function(index) { 792 this.$container 793 .find(this.depthOneWrapperSelector) 794 .eq(index) 795 .toggleClass("depth1--selected") 796 .siblings() 797 .removeClass("depth1--selected"); 798 }, 799 /** 800 * ì¤í¬ë¡¤ì ìì± ë° ì¤í¬ë¡¤ ì¬ì´ì¦ë¥¼ ì¡°ì íë¤. 801 */ 802 setScroller: function() { 803 if (!this.hasScrollbar()) { 804 /** 805 * ì¤í¬ë¡¤ë°ê° ì ì©ëë ìì를 ê°ì²´ë¡ ë´ìì ì ì©íë©´ ì¤í¬ë¡¤ë°ê° ì ëë¡ ìëíì§ ìë ì´ìê° ìì´ 806 * ë³ëì ê°ì²´ë¡ ë´ì ëì§ ìê³ ì¤í¬ë¦½í¸ ì ì© 807 */ 808 809 $(this.scrollInnerSelector) 810 .not(".scroll-content") 811 .scrollbar(); 812 $(this.scrollInnerSelector) 813 .not(".scroll-content") 814 .attr("data-scrollbar", true); 815 } 816 817 var height = this.getContentHeight(); 818 819 $(this.scrollInnerSelector) 820 .not(".scroll-content") 821 .outerHeight(height); 822 }, 823 /** 824 * ì¤í¬ë¡¤ì´ íììë 모ë°ì¼ììë ì¤í¬ë¡¤ì ìì íë¤. 825 */ 826 removeScroller: function() { 827 if (!this.hasScrollbar()) return; 828 829 this.$scrollBox.html(this.originChildren); 830 this.$subMenuToggler = this.$container.find(this.subToggleSelector); 831 }, 832 /** 833 * ì ì²´ë©ë´ì ì ì©ë ëì´ê°ì ìì±. 834 * ì¤í¬ë¡¤ ì¤í¬ë¦½í¸ë¥¼ ì ì©í기 ìí´ìë ëì´ê°ì´ íìí기 ë문ì ì¤í¬ë¦½í¸ë¡ ëì´ê°ì ì ì©. 835 */ 836 getContentHeight: function() { 837 return ( 838 this.$allMenuInner.outerHeight(true) - 839 this.$allMenuTitle.outerHeight(true) 840 ); 841 }, 842 /** 843 * íì¬ ì¤í¬ë¡¤ ì¤í¬ë¦½í¸ê° ì ì©ëì´ ìëì§ ì²´í¬íë¤. 844 */ 845 hasScrollbar: function() { 846 var $scrollInner = $(this.scrollInnerSelector).not(".scroll-content");
847 var isScroll = $scrollInner.attr("data-scrollbar") === "true"; 848 849 return isScroll; 850 }, 851 /** ì´ê¸° ë° íì¬ ë©ë´ì íì¥/ì¶ì ìí를 ì²´í¬í기 ìí ê° */ 852 isExpanded: false, 853 isSubAllExpanded: false, 854 /** trueì´ë©´ ë©ë´ë¥¼ íì¥íìë 모ë ììê° íì¥ëì´ ìì */ 855 defaultStateDesktop: true, // ë°ì¤í¬í 856 defaultStateTablet: false, // í ë¸ë¦¿ 857 defaultStateMobile: false // 모ë°ì¼ 858}; 859 860/************************************************************************************* 861 ê°ìí¤ë³´ë 862**************************************************************************************/ 863var VRKeyboard = function (inputSelector, openerSelector, keyboardWrapper, options) { 864 this.setting = $.extend({ 865 closerSelector:'.worldword-close', 866 languageTabsSelector: '.language a', 867 languageTabpanelsSelector: ".language-contents", 868 initialLanguage: 'íë¼ê°ë', 869 activeClassName: "selected", 870 position: { top: null, left: null, bottom: null, right: null, zIndex: null }, 871 872 focusTargetWhenClosed: null, 873 }, options || {}); 874 875 876 if(!$(inputSelector).length) { 877 return console.warn('ê°ìí¤ë³´ë ì´ê¸°í ì¤í¨:' + inputSelector + 'ìì'); 878 } 879 if(!$(openerSelector).length) { 880 return console.warn('ê°ìí¤ë³´ë ì´ê¸°í ì¤í¨:' + opener
880Selector + 'ìì'); 881 } 882 if(!$(keyboardWrapper).length) { 883 return console.warn('ê°ìí¤ë³´ë ì´ê¸°í ì¤í¨:' + keyboardWrapper + 'ìì'); 884 } 885 this.init(inputSelector, openerSelector, keyboardWrapper); 886} 887 888VRKeyboard.prototype = { 889 constructor: this.constructor, 890 891 init: function (inputSelector, openerSelector, keyboardWrapper) { 892 this.$input = $(inputSelector); 893 this.$opener = $(openerSelector); 894 this.$keyboardWrapper = $(keyboardWrapper); 895 this.$keyboard = this.getCloneVrKeyboard(); 896 this.$closer = this.$keyboard.find(this.setting.closerSelector); 897 this.$languageTabs = this.$keyboard.find(this.setting.languageTabsSelector); 898 this.$languageTabpanels = this.$keyboard.find(this.setting.languageTabpanelsSelector); 899 900 if (this.getPosition(this.$keyboardWrapper) === 'static') { 901 this.setPosition(this.$keyboardWrapper, 'relative'); 902 } 903 904 905 this.$keyboardWrapper.append(this.$keyboard); 906 this.$keyboard.css(this.setting.position); 907 this.currentLanguage = this.setting.initialLanguage; 908 909 this.showLanguage(this.setting.initialLanguage); 910 911 this.$opener.on('click', $.proxy(function () { 912 if(this.$opener.attr("title") == "ë¤êµì´ì ë ¥ê¸° ì´ê¸°"){ 913 this.$opener.attr("title","ë¤êµì´ì ë ¥ê¸° ë«ê¸°"); 914 this.$opener.find(".sr-only").text("ë¤êµì´ì ë ¥ê¸° ë«ê¸°"); 915 }else if(this.$opener.attr("title") == "ë¤êµì´ì ë ¥ê¸° ë«ê¸°"){ 916 this.$opener.attr("title","ë¤êµì´ì ë ¥ê¸° ì´ê¸°"); 917 this.$opener.find(".sr-only").text("ë¤êµì´ì ë ¥ê¸° ì´ê¸°"); 918 }else if(this.$opener.attr("title") == "ì´ê¸°"){ 919 this.$opener.attr("title","ë«ê¸°"); 920 }else{ 921 this.$opener.attr("title","ì´ê¸°"); 922 } 923 this.$keyboard.toggle(); 924 this.$keyboard.find("input, select, button, a").first().focus(); 925 }, this)); 926 927 this.$closer.on('click', $.proxy(function () { 928 ( this.setting.focusTargetWhenClosed && $(this.setting.focusTargetWhenClosed).focus() ) || this.$opener.focus(); 929 this.$opener.attr("title","ì´ê¸°"); 930 this.$keyboard.hide(); 931 }, this)); 932 933 this.$languageTabs.on('click', $.proxy(function (e) { 934 e.target.title = 'ì íë¨'; 935 this.languageController(e) 936 }, this)); 937 938 this.$languageTabpanels.on('click', 'a', $.proxy(function (e) { 939 e.preventDefault(); 940 941 var inputVal = this.$input.val(); 942 var val = e.target.innerText 943 944 this.$input.trigger('change'); 945 this.$input.val(inputVal + val) 946 }, this)); 947 }, 948 949 getCloneVrKeyboard: function () { 950 window.$originVRKeyboard = (window.$originVRKeyboard && window.$originVRKeyboard.length) ? window.$originVRKeyboard : $('.worldword-wrap'); 951 952 if (!window.$originVRKeyboard.length) { 953 return console.warn('ê°ìí¤ë³´ëê° ììµëë¤.'); 954 } 955 956 return window.$originVRKeyboard.clone(); 957 }, 958 959 getPosition: function ($el) { 960 return $el.css('position'); 961 }, 962 963 setPosition: function ($el, position) { 964 $el.css('position', position); 965 }, 966 languageController: function(e) { 967 var type = $(e.target).attr("data-type"); 968 969 this.hideLanguage(this.currentLanguage); 970 this.showLanguage(type); 971 }, 972 showLanguage: function(type) { 973 var $languageTab = this.$keyboard.find( 974 this.setting.languageTabsSelector + "[data-type=" + type + "]" 975 ); 976 var $languageTabpanel = this.$keyboard.find( 977 this.setting.languageTabpanelsSelector + "[data-type=" + type + "]" 978 ); 979 980 $languageTab.addClass(this.setting.activeClassName); 981 $languageTabpanel.show(); 982 this.currentLanguage = type; 983 }, 984 hideLanguage: function(type) { 985 var $languageTab = this.$keyboard.find( 986 this.setting.languageTabsSelector + "[data-type=" + type + "]" 987 ); 988 var $languageTabpanel = this.$keyboard.find( 989 this.setting.languageTabpanelsSelector + "[data-type=" + type + "]" 990 ); 991 $languageTab[0].title = ''; 992 $languageTab.removeClass(this.setting.activeClassName); 993 $languageTabpanel.hide(); 994 }, 995} 996 997/************************************************************************************* 998 ê²ììì(with mobile) 999**************************************************************************************/ 1000var search = { 1001 init: function() {
1002 // ê¸°ë³¸ê° ì¤ì 1003 this.speed = 500; // íì¥ì¶ì ìë 1004 1005 // íìí ê°ì²´ ì í 1006 this.$container = $(".header__search-wrap"); 1007 this.$toggler = this.$container.find(".btn-search--open"); 1008 this.$closeer = this.$container.find(".btn-search--close"); 1009 this.$allMenu = this.$container.find(".search-all-wrap"); 1010 this.scrollInnerSelector = ".search-all-inner--scroll.scrollbar-outer"; 1011 1012 // ì¤í¬ë¡¤ ìì 1013 this.$scrollBox = this.$container.find(".search-all-inner--scrollbox"); 1014 this.$allMenuInner = this.$container.find(".search-all-inner"); 1015 this.$subMenuToggler = this.$container.find(this.subToggleSelector); 1016 // ì¤í¬ë¡¤ ìì ì본 DOM 1017 this.originChildren = this.$scrollBox.html(); 1018 this.changeMobileDevice = false; 1019 1020 this.reset(); 1021 this.isExpanded ? this.expanded(0) : this.collapsed(0); // ë¡ëì ë기 ìí 1022 1023 // ì´ë²¤í¸ ë°ì¸ë 1024 $win.on("resize", $.proxy(this.reset, this)); 1025 this.$toggler.on("click", $.proxy(this.controller, this)); 1026 this.$closeer.on("click", $.proxy(this.collapsed, this)); 1027 this.$allMenu.on( 1028 "click", 1029 this.depthOneToggleSelector, 1030 $.proxy(this.togglerMobileDepthOneMenu, this) 1031 ); 1032 this.$allMenu.on( 1033 "click", 1034 this.subToggleSelector, 1035 $.proxy(this.subController, this) 1036 ); 1037 1038 //커ì¤í ì´ë²¤í¸ ë±ë¡ 1039 commons.event.listener(EVENT.ON_CHANGE_DOM_SIZE, $.proxy(this.reset, this)); 1040 }, 1041 /** 1042 * window resize / EVENT.ON_CHANGE_DOM_SIZE ì´ë²¤í¸ ë°ì ì 1043 */ 1044 reset: function(e, eventName) { 1045 var speed = eventName === EVENT.ON_CHANGE_DOM_SIZE ? this.speed : 0; 1046 1047 // íì ë©ë´ 모ëê° íì±í ëì´ì¼ íëì§ ìëì§ë¥¼ ì²´í¬ 1048 this.isSubAllExpanded = 1049 commons.getDeviceType() === DEVICE_TYPE_DESKTOP 1050 ? this.defaultStateDesktop 1051 : commons.getDeviceType() === DEVICE_TYPE_TABLET 1052 ? this.defaultStateTablet 1053 : this.defaultStateMobile; 1054 1055 // íì ë©ë´ 모ëê° íì±í ì¬ë¶ì ë°ë¼ ì ì²´ë©ë´ íì±í ë¹íì±í. 1056 this.isSubAllExpanded 1057 ? this.allExpandedSubMenu(0) 1058 : this.allCollapsedSubMenu(0); 1059 1060 // íì¥ëì´ ìì ê²½ì°ìë§ íì¥ì´ë²¤í¸ ì¤í 1061 this.isExpanded && this.expanded(speed); 1062 }, 1063 /** 1064 * í¤ë를 ì ì¸í ëë¨¸ì§ ëì´ê° === PCìì ì ì²´ë©ë´ì ëì´ê° 1065 */ 1066 withoutHeaderHeight: function() { 1067 var windowHeight = $win.outerHeight(); 1068 // stickyHeaderê°ì²´ìì ì§ì ë©ìëë¡ ë³´ì¬ì§ê³ ìë í¤ëì ëì´ê°ì ê°ì ¸ì´ 1069 var headerHeight = stickyHeader.getHeaderHeight(); 1070 1071 return windowHeight - headerHeight; 1072 }, 1073 /** 1074 * ì ì²´ë©ë´ë¥¼ íì¥/ì¶ìí ì§ ê²°ì íì¬ íì¥/ì¶ì ë©ìë를 í¸ì¶íë¤. 1075 */ 1076 controller: function(e) { 1077 e.preventDefault(); 1078 var isExpand = this.$toggler.attr(A11Y.EXPANDED) === "true"; 1079 1080 isExpand ? this.collapsed() : this.expanded(); 1081 }, 1082 /** 1083 * ì ì²´ë©ë´ë¥¼ íëíë¤. 1084 */ 1085 expanded: function(speed) { 1086 // ì¤í¼ë ì¤ì (íë¼ë¯¸í°ê°ì´ ìì¼ë©´ íë¼ë¯¸í° ê°ì¼ë¡ ìì¼ë©´ 기본 ì¤ì ê°ì¼ë¡) 1087 var speed = speed === undefined ? this.speed : speed; 1088 1089 // 모ì ê° ì¤ì 1090 var options = 1091 commons.getDeviceType() === DEVICE_TYPE_MOBILE 1092 ? { right: 0 } 1093 : { height: this.withoutHeaderHeight(), opacity: 1 }; 1094 1095 // ì ì²´ì¤í¬ë¡¤ ë§ê¸° 1096 commons.disabledScroll(); 1097 commons.disabledView(); 1098 // íµí©ê²ììì í´ëì¤ ì¶ê° 1099 //commons.addClass('search-opened'); 1100 1101 // ë²í¼ ariaê° ì¤ì 1102 this.isExpanded = true; 1103 this.$toggler.attr(A11Y.EXPANDED, this.isExpanded); 1104 1105 // 커ì¤í ì´ë²¤í¸ í¸ë¦¬ê±° -> GNB ë©ë´ ê¸°ë¥ ì¼ìì ì§ 1106 commons.event.trigger(EVENT.EXPANDED_ALLMENU, {}); 1107 1108 //íì¥ìí¤ê¸° 1109 this.$allMenu 1110 .show() 1111 .stop() 1112 .animate( 1113 options, 1114 speed, 1115 $.proxy(function() { 1116 /** ì´ê¸° 모ì ëëë©´... */ 1117 1118 /** 1119 * pc/í ë¸ë¦¿ì¸ ê²½ì° ì¤í¬ë¡¤ ì ì©. 1120 * 모ë°ì¼ë¡ ëì´ê°ë ìê° ìì 1121 */ 1122 1123 if (commons.getDeviceType() === DEVICE_TYPE_MOBILE) { 1124 return; 1125 } 1126 1127 this.setScroller(); 1128 }, this) 1129 ); 1130 }, 1131 /** 1132 * ì ì²´ë©ë´ë¥¼ ì¶ìíë¤. 1133 */ 1134 collapsed: function(speed) { 1135 // ì¤í¼ë ì¤ì (íë¼ë¯¸í°ê°ì´ ìì¼ë©´ íë¼ë¯¸í° ê°
1135ì¼ë¡ ìì¼ë©´ 기본 ì¤ì ê°ì¼ë¡) 1136 var speed = speed === undefined ? this.speed : speed; 1137 // 모ì ê° ì¤ì 1138 var options = 1139 commons.getDeviceType() === DEVICE_TYPE_MOBILE 1140 ? { right: "-100%" } 1141 : { height: 0, opacity: 0 }; 1142 1143 // ì ì²´ì¤í¬ë¡¤ íì±í 1144 commons.enabledScroll(); 1145 commons.enabledView(); 1146 1147 // ë²í¼ ariaê° ì¤ì 1148 this.isExpanded = false; 1149 this.$toggler.attr(A11Y.EXPANDED, this.isExpanded); 1150 1151 // 커ì¤í ì´ë²¤í¸ í¸ë¦¬ê±° -> GNB ë©ë´ ê¸°ë¥ ì¼ìì ì§í기 1152 commons.event.trigger(EVENT.COLLAPSED_ALLMENU, {}); 1153 1154 // ë¹íì±í 모ì 1155 this.$allMenu.stop().animate(options, { 1156 duration: speed, 1157 complete: $.proxy(function() { 1158 /** ë«ê¸° 모ì ëëë©´... */ 1159 // ì ì²´ë©ë´ display:none ì²ë¦¬ 1160 this.$allMenu.removeAttr("style"); 1161 // 기본 íì ë©ë´ìíê° ì´ë ¤ ìë ê±°ë¼ë©´ 모ë íìë©ë´ íì¥ ìëë¼ë©´ ì¶ì 1162 this.isSubAllExpanded 1163 ? this.allExpandedSubMenu(0) 1164 : this.allCollapsedSubMenu(0); 1165 }, this) 1166 }); 1167 }, 1168 /** 1169 * íìë©ë´ë¥¼ íì¥/ì¶ìí ì§ ê²°ì íì¬ íì¥/ì¶ì ë©ìë를 í¸ì¶íë¤. 1170 */ 1171 subController: function(e) { 1172 var $target = $(e.currentTarget); 1173 var isExpand = $target.attr(A11Y.EXPANDED); 1174 1175 // aria-expandedê° ìì¼ë©´ íì ë©ë´ê° ìë ê²ì¼ë¡ í¨ì를 ì¢ ë£íë¤. 1176 if (isExpand === undefined) { 1177 return; 1178 } 1179 // 기본 기ë¥ì ë§ëë¤.(ë§í¬ì´ëë§ê¸°) 1180 e.preventDefault(); 1181 // íì¥ì¬ë¶ì ë°ë¼ íìë©ë´ë¥¼ íì¥/ì¶ìíë¤. 1182 isExpand === "true" 1183 ? this.collapsedSubMenu($target) 1184 : this.expandedSubMenu($target); 1185 }, 1186 /** 1187 * íìë©ë´ë¥¼ íì¥íë¤. 1188 */ 1189 expandedSubMenu: function($target, speed) { 1190 var speed = speed === undefined ? this.speed : speed; 1191 1192 // íì¥ì¶ìë íì ë©ë´ë¦¬ì¤í¸ 1193 var $subMenu = $target.siblings(this.subMenuSelector); 1194 1195 // 기본ì íì¥ëì´ ìë ìì´í ì ì¶ììí¨ë¤. 1196 !this.isSubAllExpanded && 1197 this.collapsedSubMenu( 1198 $target 1199 .parents() 1200 .siblings() 1201 .find("[" + A11Y.EXPANDED + "=true]") 1202 ); 1203 1204 // í´ë¦í 2ëì¤ ë©ë´ìì´í ì ì리ìê° ë³ê²½ 1205 $target.attr(A11Y.EXPANDED, true); 1206 1207 // íìë©ë´ íë 1208 $subMenu.stop().slideDown( 1209 $.proxy(function() { 1210 $subMenu.attr("style", "display:block"); 1211 }, this) 1212 ); 1213 }, 1214 /** 1215 * íìë©ë´ë¥¼ ì¶ìíë¤. 1216 */ 1217 collapsedSubMenu: function($target, speed) { 1218 if (this.isSubAllExpanded) return; 1219 var speed = speed === undefined ? this.speed : speed; 1220 1221 // íì¥ì¶ìë íì ë©ë´ë¦¬ì¤í¸ 1222 var $subMenu = $target.siblings(this.subMenuSelector); 1223 1224 // í´ë¦í 2ëì¤ ë©ë´ìì´í ì ì리ìê° ë³ê²½ 1225 $target.attr(A11Y.EXPANDED, false); 1226 1227 // íìë©ë´ ì¶ì 1228 $subMenu.stop().slideUp( 1229 $.proxy(function() { 1230 $subMenu.attr("style", "display:none"); 1231 }, this) 1232 ); 1233 }, 1234 /** 1235 * 모ë íì ë©ë´ë¥¼ íì¥ìí¨ë¤. 1236 */ 1237 allExpandedSubMenu: function() { 1238 var $subMenus = this.$subMenuToggler.siblings(this.subMenuSelector); 1239 1240 // íì ë©ë´ë¥¼ ë³´ì´ê³ íìë©ë´ê° ìë 2ëì¤ ìì´í ìë§ aria ìì± ì ì© 1241 $subMenus 1242 .show() 1243 .siblings(this.$subMenuToggler) 1244 .attr(A11Y.EXPANDED, true); 1245 }, 1246 /** 1247 * 모ë íì ë©ë´ë¥¼ ì¶ììí¨ë¤. 1248 */ 1249 allCollapsedSubMenu: function() { 1250 var $subMenus = this.$subMenuToggler.siblings(this.subMenuSelector); 1251 1252 // íì ë©ë´ë¥¼ ì¨ê¸°ê³ íìë©ë´ê° ìë 2ëì¤ ìì´í ìë§ aria ìì± ì ì© 1253 $subMenus 1254 .hide() 1255 .siblings(this.$subMenuToggler) 1256 .attr(A11Y.EXPANDED, false); 1257 }, 1258 1259 /** 1260 * ì¤í¬ë¡¤ì ìì± ë° ì¤í¬ë¡¤ ì¬ì´ì¦ë¥¼ ì¡°ì íë¤. 1261 */ 1262 setScroller: function() { 1263 if (!this.hasScrollbar()) { 1264 /** 1265 * ì¤í¬ë¡¤ë°ê° ì ì©ëë ìì를 ê°ì²´ë¡ ë´ìì ì ì©íë©´ ì¤í¬ë¡¤ë°ê° ì ëë¡ ìëíì§ ìë ì´ìê° ìì´ 1266 * ë³ëì ê°ì²´ë¡ ë´ì ëì§ ìê³ ì¤í¬ë¦½í¸ ì ì© 1267 */ 1268 1269 $(this.scrollInnerSelector) 1270 .not(".scroll-content") 1271 .scrollbar(); 1272 $(this.scrollInnerSelector) 1273 .not(".scroll-content") 1274 .attr("data-scrollbar", true); 1275 } 1276 1277 var height = this.getContentHeight(); 1278 1279 $(this.scrollInnerSelector) 1280 .not(".scroll-content") 1281 .outerHeight(height); 1282 }, 1283 /** 1284 * ì¤í¬ë¡¤ì´ íììë 모ë°ì¼ììë ì¤í¬ë¡¤ì ìì íë¤. 1285 */ 1286 removeScroller: function() { 1287 if (!this.hasScrollbar()) return; 1288 1289 this.$scrollBox.html(this.originChildren); 1290 this.$subMenuToggler = this.$container.find(this.subToggleSelector); 1291 }, 1292 /** 1293 * ì ì²´ë©ë´ì ì ì©ë ëì´ê°ì ìì±. 1294 * ì¤í¬ë¡¤ ì¤í¬ë¦½í¸ë¥¼ ì ì©í기 ìí´ìë ëì´ê°ì´ íìí기 ë문ì ì¤í¬ë¦½í¸ë¡ ëì´ê°ì ì ì©. 1295 */ 1296 getContentHeight: function() { 1297 return ( 1298 this.$allMenuInner.outerHeight(true) - 1299 this.$allMenuTitle.outerHeight(true) 1300 ); 1301 }, 1302 /** 1303 * íì¬ ì¤í¬ë¡¤ ì¤í¬ë¦½í¸ê° ì ì©ëì´ ìëì§ ì²´í¬íë¤. 1304 */ 1305 hasScrollbar: function() { 1306 var $scrollInner = $(this.scrollInnerSelector).not(".scroll-content");
1307 var isScroll = $scrollInner.attr("data-scrollbar") === "true"; 1308 1309 return isScroll; 1310 }, 1311 /** ì´ê¸° ë° íì¬ ë©ë´ì íì¥/ì¶ì ìí를 ì²´í¬í기 ìí ê° */ 1312 isExpanded: false, 1313 isSubAllExpanded: false, 1314 /** trueì´ë©´ ë©ë´ë¥¼ íì¥íìë 모ë ììê° íì¥ëì´ ìì */ 1315 defaultStateDesktop: true, // ë°ì¤í¬í 1316 defaultStateTablet: false, // í ë¸ë¦¿ 1317 defaultStateMobile: false // 모ë°ì¼ 1318}; 1319/************************************************************************************* 1320 lnb 1321**************************************************************************************/ 1322$('.lnb li.menu-lnb__item > a').click(function(e){ 1323 var menu = $(this).closest('.menu-lnb__item'); 1324 var sub = $(this).siblings('.menu-lnb__sub'); 1325 var subSi = $(this).closest('.menu-lnb__item').siblings().not('.is_lnb1--opened').find('.menu-lnb__sub'); 1326 1327 //class 1328 var currentActive = 'is_lnb1--opened'; 1329 var currentSlide = 'is_lnb2--slideUp'; 1330 var active = 'is_lnb--opened'; 1331 1332 1333 if(!sub.length) { 1334 return; 1335 } 1336 e.preventDefault(); 1337 1338 if(menu.hasClass(currentActive)) {//íì¬ íì´ì§ ì¼ ë, 1339 if(menu.hasClass(currentSlide)) { 1340 menu.removeClass(currentSlide); 1341 menu.addClass(active); 1342 menu[0].children[0].title = 'ì 기'; 1343 sub.slideDown(); 1344 } else { 1345 menu.addClass(currentSlide); 1346 menu.removeClass(active); 1347 sub.slideUp(); 1348 menu[0].children[0].title = 'í¼ì¹ê¸°'; 1349 } 1350 } else {//íì¬ íì´ì§ ì¸ 1351 if(menu.hasClass(active)) { 1352 menu.removeClass(active); 1353 menu[0].children[0].title = 'í¼ì¹ê¸°'; 1354 sub.slideUp(); 1355 } else { 1356 menu.siblings('li').removeClass(active); 1357 subSi.slideUp(); 1358 menu.addClass(active); 1359 menu[0].children[0].title = 'ì 기'; 1360 sub.slideDown(); 1361 } 1362 } 1363 1364}); 1365/************************************************************************************* 1366 categoryTabsMenu 1367**************************************************************************************/ 1368var categoryTabs = function(container, options) { 1369 /** 기본 ìµì */ 1370 this.defaultOption = { 1371 1372 tabListClassName: ".category_list", 1373 tabItemClassName: ".category_item", 1374 tabPanelWrapClassName: ".category_tabpanel_wrap", 1375 tabPanelClassName: ".category_tabpanel", 1376 1377 // í리ì¤í¸ í ê¸ë¬(모ë°ì¼) 1378 tabTogglerClassName: ".label_wrap button", 1379 1380 /** íì íì±í ì¬ë¶ë¥¼ íë¨í ìì±ëª - íìì´í ì ì ì©ë ê° */ 1381 tabActiveStateAttrName: "data-selected", 1382 /** í í¨ëì ì ì©í ID ê°ì íì¸í ìì±ëª - íìì´í ì ì ì©ë ê° */ 1383 tabTargetSelectAttrName: "data-controls", 1384 /** í리ì¤í¸ì íì¥/ì¶ì ì¬ë¶ë¥¼ íë¬í ìì±ëª - í ê¸ë²í¼ì ì ì©ë ê° */ 1385 tabTogglerStateAttrName: "data-expanded", 1386 initialIndex: undefined, 1387 beforeTabActive: function () {}, 1388 afterTabActive: function () {}, 1389 }; 1390 1391 this.$container = $(container); 1392 this.options = options 1393 ? $.extend(this.defaultOption, options) 1394 : this.defaultOption; 1395 1396 this.init(); 1397}; 1398categoryTabs.prototype = { 1399 constructor: this.constructor, 1400 init: function() { 1401 1402 this.$tabWrapper = this.$container.find(this.options.tabListClassName); 1403 this.$tabs = this.$container.find(this.options.tabItemClassName); 1404 this.$tabpanelWrap = this.$container.find(this.options.tabPanelWrapClassName); 1405 this.$tabpanel = this.$container.find(this.options.tabPanelClassName); 1406 this.$toggler = this.$container.find(this.options.tabTogglerClassName); 1407 this.deviceType = commons.getDeviceType(); 1408 1409 // ì´ê¸° íì±í 1410 this.initActive(); 1411 1412 /** ì´ë²¤í¸ ë°ì¸ë */ 1413 this.$tabs.on("click", $.proxy(this.clickTabEventHandler, this)); 1414 this.$toggler.on("click",$.proxy(this.clickToggleButtonEventHandler, this)); 1415 this.$tabs.on('keyup', $.proxy(function (e) { 1416 var keyCode = e.keyCode || e.which; 1417 var $target = $(e.currentTarget); 1418 var $nextTarget; 1419 1420 var index = $target.index(); 1421 var isFirst = $target.attr('data-index') === 'first'; 1422 var isLast = $target.attr('data-index') === 'last'; 1423 1424 if (37 === keyCode || 39 === keyCode || 13 === keyCode) { 1425 e.preventDefault(); 1426 } else { 1427 return; 1428 } 1429 1430 switch (keyCode) { 1431 case 13: 1432 this.activeTab($target); 1433 break; 1434 case 37: 1435 if (isFirst) {
1436 $nextTarget = this.$tabs.last() 1437 } else { 1438 $nextTarget = this.$tabs.eq(index - 1) 1439 } 1440 $nextTarget.focus(); 1441 break; 1442 case 39: 1443 if (isLast) { 1444 $nextTarget = this.$tabs.first() 1445 } else { 1446 $nextTarget = this.$tabs.eq(index + 1) 1447 } 1448 $nextTarget.focus(); 1449 break; 1450 } 1451 }, this)); 1452 $win.on("resize", $.proxy(this.resizingWindowEventHandler, this)); 1453 }, 1454 /** ì´ê¸°ì íì íì±í í기ìí í¨ì */ 1455 initActive: function() { 1456 var $activeTab = this.$tabWrapper.find( 1457 "[" + this.options.tabActiveStateAttrName + ' ="true"]' 1458 ); 1459 1460 this.$tabs.first().attr('data-index', 'first'); 1461 this.$tabs.first().find('a').attr('title', 'ì íë¨'); 1462 this.$tabs.last().attr('data-index', 'last'); 1463 1464// this.$tabs.find('a').removeAttr('href'); 1465// this.$tabs.find('a, button').attr({ 'disabled':true, 'role':'non presentation' }); 1466 //this.$tabs.find('a, button').attr({'role':'tab'}); 1467 1468 if ($activeTab.length) { 1469 this.activeTab($activeTab); 1470 } else { 1471 this.activeTab(this.$tabs.eq(this.options.initialIndex)); 1472 } 1473 }, 1474 isMobile: function() { 1475 return commons.getDeviceType() === DEVICE_TYPE_MOBILE; 1476 }, 1477 resizingWindowEventHandler: function() { 1478 if (this.deviceType === commons.getDeviceType()) { 1479 return; 1480 } 1481 this.deviceType = commons.getDeviceType(); 1482 this.collapsed(0); 1483 }, 1484 /** 1485 * í ìì´í ì í´ë¦íìë ì¤íí í¸ë¤ë¬ 1486 * ì¡°ê±´ì ë°ë¼ íì íì±í ìí¨ë¤. 1487 */ 1488 clickTabEventHandler: function(e) { 1489 1490 e.preventDefault(); 1491 1492 var $target = $(e.currentTarget); 1493 // íì¬ í ì í ì¬ë¶ì²´í¬ 1494 var isSelected = $target.attr(this.options.tabActiveStateAttrName) === "true"; 1495 var isMobile = this.isMobile(); 1496 1497 // 모ë°ì¼ íì¥ë í리ì¤í¸ë¥¼ ì¶ì 1498 isMobile && this.collapsed(0); 1499 1500 if (isSelected) return; 1501 // ì íë í íì±í 1502 $target.parent().find('li').find('a').removeAttr('title'); 1503 $target.find('a').attr('title','ì íë¨'); 1504 this.activeTab($target); 1505 1506 }, 1507 /** 1508 * íë¼ë¯¸í°ë¡ ë°ì íì íì±í ìí¤ê³ íì ìì í ë¹íì±í 1509 * @param {jQuery.DOM} $target ì íë íììì jQuery ê°ì²´ 1510 */ 1511 activeTab: function($target) { 1512 //var id = $target.attr(this.options.tabTargetSelectAttrName); 1513 var text = $target.text(); 1514 var isMobile = this.isMobile(); 1515 var index = $target.index(); 1516 this.$tab 1517 $target 1518 .attr(this.options.tabActiveStateAttrName, true) 1519 .siblings() 1520 .removeAttr(this.options.tabActiveStateAttrName); 1521 this.options.beforeTabActive(index) 1522 this.$toggler.text(text); 1523 1524 $target.find('a').attr('aria-selected', 'true'); 1525 $target.siblings().find('a').attr('aria-selected', 'false'); 1526 1527 //ê°ë°ìì div íëë¡ ì ì´íê² ë ê²½ì° 1528 // íí¨ëì ìì´ë ê°ì ë³ê²½íë¤. this.$tabpanel.attr('id', id); 1529 1530 //íì±íë íìì´í ì ìì±ê° 1531 var $activeItemTab = this.$tabWrapper.find( 1532 "[" + this.options.tabActiveStateAttrName + ' ="true"]' 1533 ); 1534 var isActiveTab = $activeItemTab.attr(this.options.tabActiveStateAttrName); 1535 isActiveTab && this.activeTabPanel($activeItemTab); 1536 this.options.afterTabActive(index) 1537 }, 1538 /** 1539 * íë¼ë¯¸í°ë¡ ë°ì íì±í íì ëì¼í í¨ëí íì±í ìí¤ê³ íì ìì í ë¹íì±í 1540 * @param {jQuery.DOM} $target ì íë íììì jQuery ê°ì²´ 1541 */ 1542 activeTabPanel: function($target) { 1543 var id = $target.attr(this.options.tabTargetSelectAttrName); 1544 var $activeTabPanel = this.$tabpanelWrap.find('#' + id); 1545 $activeTabPanel.show().siblings().hide(); 1546 }, 1547 /** 1548 * í ë ì´ë¸ì í´ë¦íìë ì¤íí í¸ë¤ë¬ 1549 * í 리ì¤í¸ë¥¼ íì¥ìí¤ê±°ë ì¶ììí¨ë¤. 1550 */ 1551 clickToggleButtonEventHandler: function(e) { 1552 e.preventDefault(); 1553 var isExpanded = 1554 $(e.currentTarget).attr(this.options.tabTogglerStateAttrName) === "true"; 1555 1556 if (isExpanded) { 1557 this.collapsed(); 1558 } else { 1559 this.expanded(); 1560 } 1561 }, 1562 /** 1563 * 모ë°ì¼ìì í리ì¤í¸ë¥¼ íì¥ 1564 * @param {Number} speed íì¥ëë ìë 1565 */ 1566 expanded: function(speed) {
1567 this.$toggler.attr(this.options.tabTogglerStateAttrName, true); 1568 1569 // í리ì¤í¸ë¥¼ íì¥ 1570 this.$tabWrapper.stop().slideDown( 1571 speed, 1572 $.proxy(function() { 1573 this.$tabWrapper.attr("style", "display:block"); 1574 }, this) 1575 ); 1576 }, 1577 /** 1578 * 모ë°ì¼ìì í리ì¤í¸ë¥¼ ì¶ì 1579 * @param {Number} speed ì¶ìëë ìë 1580 */ 1581 collapsed: function(speed) { 1582 this.$toggler.attr(this.options.tabTogglerStateAttrName, false); 1583 1584 // í리ì¤í¸ë¥¼ ì¶ì 1585 this.$tabWrapper.stop().slideUp( 1586 speed, 1587 $.proxy(function() { 1588 // 모ì ì´ ì¢ ë£ëë©´ ì¸ë¼ì¸ styleì ì´ê¸°í 1589 this.$tabWrapper.removeAttr("style"); 1590 }, this) 1591 ); 1592 } 1593}; 1594/************************************************************************************* 1595 tab 1596**************************************************************************************/ 1597var Tabs = function(container, options) { 1598 this.defaultOption = { 1599 tabListClassName: ".tab_list", 1600 tabItemClassName: ".tab_item", 1601 tabPanelWrapClassName: ".tabpanel_wrap", 1602 tabPanelClassName: ".tabpanel", 1603 1604 // í리ì¤í¸ í ê¸ë¬(모ë°ì¼) 1605 //tabTogglerClassName: '.label_wrap button', 1606 1607 /** íì íì±í ì¬ë¶ë¥¼ íë¨í ìì±ëª - íìì´í ì ì ì©ë ê° */ 1608 tabActiveStateAttrName: "data-selected", 1609 /** í í¨ëì ì ì©í ID ê°ì íì¸í ìì±ëª - íìì´í ì ì ì©ë ê° */ 1610 tabTargetSelectAttrName: "data-controls", 1611 /** í리ì¤í¸ì íì¥/ì¶ì ì¬ë¶ë¥¼ íë¬í ìì±ëª - í ê¸ë²í¼ì ì ì©ë ê° */ 1612 tabTogglerStateAttrName: "data-expanded", 1613 initialIndex: undefined, 1614 beforeTabActive: function () {}, 1615 afterTabActive: function () {}, 1616 }; 1617 1618 this.$container = $(container); 1619 this.options = options 1620 ? $.extend(this.defaultOption, options) 1621 : this.defaultOption; 1622 1623 this.init(); 1624}; 1625 1626Tabs.prototype = { 1627 constructor: this.constructor, 1628 init: function() { 1629 this.$tabWrapper = this.$container.find(this.options.tabListClassName); 1630 this.$tabs = this.$container.find(this.options.tabItemClassName); 1631 this.$tabpanelWrap = this.$container.find( 1632 this.options.tabPanelWrapClassName 1633 ); 1634 this.$tabpanel = this.$container.find(this.options.tabPanelClassName); 1635 1636 // ì´ê¸° íì±í 1637 this.initActive(); 1638 1639 /** ì´ë²¤í¸ ë°ì¸ë */ 1640 this.$tabs.on('click', $.proxy(this.clickTabEventHandler, this)); 1641 this.$tabs.on('keyup', $.proxy(function (e) { 1642 var keyCode = e.keyCode || e.which; 1643 var $target = $(e.currentTarget); 1644 var $nextTarget; 1645 1646 var index = $target.index(); 1647 var isFirst = $target.attr('data-index') === 'first'; 1648 var isLast = $target.attr('data-index') === 'last'; 1649 1650 if (37 === keyCode || 39 === keyCode || 13 === keyCode) { 1651 e.preventDefault(); 1652 } else { 1653 return; 1654 } 1655 1656 switch (keyCode) { 1657 case 13: 1658 this.activeTab($target); 1659 break; 1660 case 37: 1661 if (isFirst) { 1662 $nextTarget = this.$tabs.last() 1663 } else { 1664 $nextTarget = this.$tabs.eq(index - 1) 1665 } 1666 $nextTarget.addClass('is_focus').focus().siblings().removeClass('is_focus'); 1667 break; 1668 case 39: 1669 if (isLast) { 1670 $nextTarget = this.$tabs.first() 1671 } else { 1672 $nextTarget = this.$tabs.eq(index + 1) 1673 } 1674 $nextTarget.addClass('is_focus').focus().siblings().removeClass('is_focus'); 1675 break; 1676 } 1677 }, this)); 1678 }, 1679 /** ì´ê¸°ì íì íì±í í기ìí í¨ì */ 1680 initActive: function() { 1681 var $activeTab = this.$tabWrapper.find( 1682 "[" + this.options.tabActiveStateAttrName + ' ="true"]' 1683 ); 1684 1685 this.$tabs.first().attr('data-index', 'first'); 1686 this.$tabs.last().attr('data-index', 'last'); 1687 1688 //this.$tabs.find('a').removeAttr('href'); 1689 //this.$tabs.find('a, button').attr({ 'disabled':true, 'role':'non presentation' }); 1690 1691 if ($activeTab.length) { 1692 this.activeTab($activeTab); 1693 } else { 1694 this.activeTab(this.$tabs.eq(this.options.initialIndex)); 1695 } 1696 }, 1697 1698 /** 1699 * í ìì´í ì í´ë¦íìë ì¤íí í¸ë¤ë¬ 1700 * ì¡°ê±´ì ë°ë¼ íì íì±í ìí¨ë¤. 1701 */ 1702 clickTabEventHandler: function(e) { 1703 e.preventDefault(); 1704 1705 var $target = $(e.currentTarget); 1706 // íì¬ í ì í ì¬ë¶ì²´í¬ 1707 var isSelected = $target.attr(this.options.tabActiveStateAttr
1707Name) === "true"; 1708 1709 if (isSelected) return; 1710 1711 // ì íë í íì±í 1712 this.activeTab($target); 1713 }, 1714 /** 1715 * íë¼ë¯¸í°ë¡ ë°ì íì íì±í ìí¤ê³ íì ìì í ë¹íì±í 1716 * @param {jQuery.DOM} $target ì íë íììì jQuery ê°ì²´ 1717 */ 1718 activeTab: function($target) { 1719 // var id = $target.attr(this.options.tabTargetSelectAttrName); 1720 var index = $target.index(); 1721 this.$tab 1722 1723 $target 1724 //.attr('tabindex', 0) 1725 .attr(this.options.tabActiveStateAttrName, true) 1726 .siblings() 1727 //.attr('tabindex', -1) 1728 .removeAttr(this.options.tabActiveStateAttrName); 1729 1730 this.options.beforeTabActive(index) 1731 1732 //íì±íë íìì´í ì ìì±ê° 1733 var $activeItemTab = this.$tabWrapper.find( 1734 "[" + this.options.tabActiveStateAttrName + ' ="true"]' 1735 ); 1736 var isActiveTab = $activeItemTab.attr(this.options.tabActiveStateAttrName); 1737 isActiveTab && this.activeTabPanel($activeItemTab); 1738 1739 this.options.afterTabActive(index) 1740 }, 1741 /** 1742 * íë¼ë¯¸í°ë¡ ë°ì íì±í íì ëì¼í í¨ëí íì±í ìí¤ê³ íì ìì í ë¹íì±í 1743 * @param {jQuery.DOM} $target ì íë íììì jQuery ê°ì²´ 1744 */ 1745 activeTabPanel: function($target) { 1746 var id = $target.attr(this.options.tabTargetSelectAttrName); 1747 var $activeTabPanel = this.$tabpanelWrap.find('#' + id); 1748 $activeTabPanel.show().siblings().hide(); 1749 } 1750}; 1751/************************************************************************************* 1752 autocomplete 1753**************************************************************************************/ 1754var autoComplete = function(container,options){ 1755 /** 기본ìµì */ 1756 this.defaultOption = { 1757 searchKeyword : ".input-text", // 1758 autocompleteLayer : ".autocomplete_layer", 1759 autocompleteClose : ".autocomplete_close", 1760 searchBtnArrow : ".btn_arrow", 1761 }; 1762 this.$container = $(container); 1763 this.options = options ? $.extend(this.defaultOption, options) : this.defaultOption; 1764 1765 this.init(); 1766}; 1767autoComplete.prototype = { 1768 init: function(){ 1769 this.$searchKeyword = this.$container.find(this.options.searchKeyword); 1770 this.$autocompleteLayer = this.$container.find(this.options.autocompleteLayer); 1771 this.$autocompleteClose = this.$container.find(this.options.autocompleteClose); 1772 this.$searchBtnArrow = this.$container.find(this.options.searchBtnArrow); 1773 1774 /** ì´ë²¤í¸ ë°ì¸ë */ 1775 this.$searchKeyword.on("keyup", $.proxy(this.autoKeyup, this)); 1776 this.$searchKeyword.on("keydown", $.proxy(this.autoKeydown, this)); 1777 this.$autocompleteClose.on("click", $.proxy(this.collapsed, this)); 1778 this.$searchBtnArrow.on("click", $.proxy(this.toogleBtnFold, this)); 1779 }, 1780 // ê¸ì ì ë ¥ì 1781 autoKeyup: function(e) { 1782 var is_collapsed = this.$autocompleteLayer.hasClass('is_collapsed'); 1783 if(!is_collapsed){ 1784 var $searchKeywordValue = this.$searchKeyword.val(); 1785 1786 if($.trim($searchKeywordValue).length) this.$autocompleteLayer.addClass('is_expanded'); 1787 else this.$autocompleteLayer.removeClass('is_expanded'); 1788 1789 var isexpanded = this.$autocompleteLayer.hasClass('is_expanded'); 1790 if(isexpanded){ 1791 this.$searchBtnArrow.addClass('is_fold'); 1792 }else{ 1793 this.$searchBtnArrow.removeClass('is_fold'); 1794 } 1795 } 1796 }, 1797 // ê¸ì ì ë ¥ ì§ì 1798 autoKeydown: function(e){ 1799 if(event.which == 13) event.preventDefault(); 1800 }, 1801 // ìëìì± ë ì´ì´ ìëìì±ë기 í´ë¦íì ê²½ì° 1802 collapsed: function(e){ 1803 this.$autocompleteLayer.removeClass('is_expanded'); 1804 this.$autocompleteLayer.addClass('is_collapsed'); 1805 this.$searchBtnArrow.removeClass('is_fold'); 1806 }, 1807 // ìëìì± íì´í ë²í¼ í ê¸ 1808 toogleBtnFold: function(e){ 1809 var $isFold = this.$autocompleteLayer.hasClass('is_expanded'); 1810 var $arrowFlod = this.$searchBtnArrow.find('.arrow_fold'); 1811 1812 if(!$isFold){ 1813 $arrowFlod.text('ìë ìì± ì 기'); 1814 this.$autocompleteLayer.addClass('is_expanded'); 1815 this.$autocompleteLayer.removeClass('is_collapsed'); 1816 this.$searchBtnArrow.addClass('is_fold'); 1817 this.$searchBtnArrow[0].title = 'ìë ìì± ì 기'; 1818 }else{ 1819 $arrowFlod.text('ìë ìì± ì´ê¸°'); 1820 this.$autocompleteLayer.removeClass('is_expanded'); 1821 this.$searchBtnArrow.removeClass('is_fold'); 1822 this.$searchBtnArrow[0].title = 'ìë ìì± ì´ê¸°'; 1823 } 1824 } 1825}; 1826/************************************************************************************* 1827 let go!!! 1828**************************************************************************************/ 1829$(document).ready(function() { 1830 1831 commons.init(); 1832 stickyHeader.init(); 1833 noticeBanner.init(); 1834 gnb.init(); 1835 allMenu.init(); 1836 search.init();
1837 //menuLnb.init(); 1838 var currentmenu = $('.is_lnb1--opened'); 1839 currentmenu.addClass('is_current_page'); 1840 currentmenu.find('.is_lnb2--opened').attr("aria-label","íì¬ íì´ì§"); 1841 if ($('.is_current_page .is-sub__items').length > 0 ){ 1842 $('.is_current_page .is-sub__items')[0].title = 'ì 기'; 1843 } 1844 1845 1846 // ë©ì¸ 1847 var autoComplete1 = new autoComplete(".main_section .search-form-wrap"); 1848 // í¤ë ê³µíµ 1849 var autoComplete2 = new autoComplete(".header .search-form-wrap"); 1850 //ê²ì ê²°ê³¼ 1851 //var autoComplete3 = new autoComplete(".integSearch_wrap .search-form-wrap"); 1852 var autoComplete3 = new autoComplete(".new_total_search_wrap .total_srch_box"); 1853 1854 var autoComplete4 = new autoComplete(".total_search_pop .inner"); 1855 var autoComplete5 = new autoComplete(".home_main_wrap .inner"); 1856 1857 1858 var categoryTabs1 = new categoryTabs(".category_wrap", { initialIndex: 0 }); 1859 1860 var categoryTabsLayer1 = new categoryTabs(".datalayer1_wrap", { initialIndex: 0 }); 1861 var categoryTabsLayer3 = new categoryTabs(".datalayer3_wrap", { initialIndex: 0 }); 1862 var categoryTabsLayer4 = new categoryTabs(".datalayer4_wrap", { initialIndex: 0 }); 1863 var categoryTabsLayer5 = new categoryTabs(".datalayer5_wrap", { initialIndex: 0 }); 1864 var categoryTabsLayer7 = new categoryTabs(".datalayer7_wrap", { initialIndex: 0 }); 1865 1866 var boardTabWrap = new Tabs(".board_tab_wrap", { initialIndex: 0 }); 1867 var shortcutWrap = new Tabs(".shortcut_wrap", { initialIndex: 0 }); 1868 var applyTabWrap = new Tabs(".apply_tab_wrap", { initialIndex: 0 }); 1869 var categoryInfoWrap = new Tabs(".category_info_wrap", { initialIndex: 0 }); 1870 var typeServiceWrap = new Tabs(".type_service_wrap", { 1871 initialIndex: 0, 1872 tabListClassName: ".type_list", 1873 tabItemClassName: ".type_item", 1874 tabPanelWrapClassName: ".type_tabpanel_wrap", 1875 tabPanelClassName: ".type_tabpanel", 1876 }); 1877 1878 //PC 모ë°ì¼ 1879 /*var vrKeyboard1 = new VRKeyboard( 1880 '.header__inner-top .input-text-wrap input', 1881 '.header__inner-top .btn-worldword', 1882 '.header__inner-top .keyboard-wrapper', 1883 { position: { top: '100%', right: 0, marginTop: '10px' } } 1884 );*/ 1885 var vrKeyboard1 = new VRKeyboard( 1886 '.total_search_pop .total_srch_pop_input input', 1887 '.total_search_pop .btn-worldword', 1888 '.total_search_pop .keyboard-wrapper', 1889 { position: { top: '100%', right: 0, marginTop: '10px' } } 1890 ); 1891 1892 var vrKeyboard10 = new VRKeyboard( 1893 '.nl_header_top .input-text-wrap input', 1894 '.nl_header_top .btn-worldword', 1895 '.nl_header_top .keyboard-wrapper', 1896 { position: { top: '100%', right: 0, marginTop: '10px' } } 1897 ); 1898 1899 var vrKeyboard11 = new VRKeyboard( 1900 '.home_main_wrap .total_srch_pop_input input', 1901 '.home_main_wrap .btn-worldword', 1902 '.home_main_wrap .keyboard-wrapper', 1903 { position: { top: '100%', marginTop: '-25px' } } 1904 ); 1905 1906 var vrKeyboard12 = new VRKeyboard( 1907 '.total_search_pop .total_srch_pop_input_sub input', 1908 '.total_search_pop .btn-worldword', 1909 '.total_search_pop .keyboard-wrapper', 1910 { position: { top: '100%', right: 0, marginTop: '10px' } } 1911 ); 1912 1913 //PC ì½í ì¸ ìì 1914 var vrKeyboard2 = new VRKeyboard( 1915 '.main_wide .input-text-wrap input', 1916 '.main_wide .btn-worldword', 1917 '.main_wide .btn-worldword-wrap', 1918 { 1919 position: { top: '100%', right: 0 }, 1920 // í¤ë³´ëê° ë«í ë í¹ì ììì í¬ì»¤ì¤ë¥¼ ì´ëìì¼ì¼í ë 1921 // focusTargetWhenClosed: '.main_search .btn-search', 1922 } 1923 ); 1924 1925 //PC ìë¸ í¤ë ìì 1926 var vrKeyboard3 = new VRKeyboard( 1927 '.wide-search-wrap .input-text-wrap input', 1928 '.wide-search-wrap .btn-worldword', 1929 '.wide-search-wrap .keyboard-wrapper', 1930 { position: { top: '100%', right: 0 } } 1931 ); 1932 //MO ìë¸ í¤ë ìì 1933 var vrKeyboard4 = new VRKeyboard( 1934 '.search__utils-wrap .input-text-wrap input', 1935 '.search__utils-wrap .btn-worldword', 1936 '.search__utils-wrap .btn-worldword-wrap', 1937 { position: { top: 'auto', right: '-110%' } } 1938 ); 1939 1940 //ìì¥ìë£ 1941 var vrKeyboard5 = new VRKeyboard( 1942 '.collect_search_wrap .input_text_wrap input', 1943 '.collect_search_wrap .btn-worldword', 1944 '.collect_search_wrap .btn-worldword-wrap', 1945 { position: { top: '50px', right: -60 } } 1946 ); 1947 1948 //구íêµê´ë³´ 1949 var vrKeyboard6 = new VRKeyboard( 1950 '.old_search_wrap .input_text_wrap input', 1951 '.old_search_wrap .btn-worldword', 1952 '.old_search_wrap .btn-worldword-wrap', 1953 { position: { top: 'auto', right: -30 } } 1954 ); 1955 1956 //ì 문 í¤ìë ê²ì
1957 var keywordSearchWrap = new VRKeyboard( 1958 '.keyword_search_wrap .input_text_wrap input', 1959 '.keyword_search_wrap .btn-worldword', 1960 '.keyword_search_wrap .btn-worldword-wrap', 1961 { position: { top: 'auto', right: -30 } } 1962 ); 1963 1964 1965 //íµí©ê²ì 1966 1967 /*var vrKeyboardNlSearch = new VRKeyboard( 1968 '.search-form_group .input-text-wrap input', 1969 '.search-form_group .btn-worldword', 1970 '.search-form_group .btn-worldword-wrap', 1971 { position: { top: 'auto', right: -30 } } 1972 );*/ 1973 1974 1975}); 1976 1977$(function(){ 1978 1979 $(window).scroll(function(){ //ì¤í¬ë¡¤íë©´ ìë ì½ë ì¤í 1980 if ($(window).width() > 767){ 1981 var num = $(this).scrollTop(); // ì¤í¬ë¡¤ê° 1982 if( num > $("#header").outerHeight()+$(".header__inner-bottom").outerHeight()){ // ì¤í¬ë¡¤ì 36ì´ì íì ë 1983 $(".sub .wide-search-wrap").addClass("fixed_list"); 1984 $(".sub").addClass("sub_fixed2"); 1985 $(".sub .menu-tool-wrap").css({"display":"block"}); 1986 $(".btn-open-pc").click(function(){ 1987 if($(".menu-tool-gray .btn-open-pc").hasClass('on')) $(".gray-gnb-wrap").addClass('on'); 1988 else $(".gray-gnb-wrap").removeClass('on'); 1989 }); 1990 1991 }else{ 1992 $(".sub .wide-search-wrap").removeClass("fixed_list"); 1993 $(".sub").removeClass("sub_fixed2"); 1994 $(".gray-gnb-wrap").removeClass('on'); 1995 $(".menu-tool-gray .btn-open-pc").removeClass('on'); 1996 $(".sub .menu-tool-wrap").css({"display":"none"}); 1997 $(".sub .gray-gnb-wrap").css({"display":"none"}); 1998 } 1999 }; 2000 2001 // if($(window).width() > 767) { 2002 // $(window).on('resize', function(){location.reload();}); 2003 // } 2004 }); 2005}); 2006 2007$(function(){ 2008 $(window).scroll(function(){ //ì¤í¬ë¡¤íë©´ ìë ì½ë ì¤í 2009 if ($(window).width() > 767){ 2010 var num = $(this).scrollTop(); // ì¤í¬ë¡¤ê° 2011 if( num > 319 ){ // ì¤í¬ë¡¤ì 36ì´ì íì ë 2012 $(".main .wide-search-wrap").addClass("fixed_list"); 2013 //$(".main .menu-tool-wrap").css({"display":"block"}); 2014 //$(".main .menu-tool-wrap").css({"display":"none"}); 2015 }else{ 2016 $(".main .wide-search-wrap").removeClass("fixed_list"); 2017 //$(".main .menu-tool-wrap").css({"display":"none"}); 2018 } 2019 } 2020 /*if($(document).scrollTop()>0) { 2021 $(".banner__content").attr("style", "display:none"); 2022 } else { 2023 $(".banner__content").attr("style", "display:block"); 2024 }*/ 2025 }); 2026}); 2027 2028$(function(){ 2029 $('.btn-open-pc').click(function(){ 2030 }); 2031/* $(".menu-tool-gray .btn-open-pc").click(function(){ 2032 $(this).toggleClass("on"); 2033 });*/ 2034 $('.btn-open-pc').click(function(){ 2035 $(".gray-gnb-wrap").toggle(); 2036 }); 2037 $(".menu-tool-gray .btn-open-pc").click(function(){ 2038 $(this).toggleClass("on"); 2039 }); 2040 $(".gray-gnb-depth1__item").hover(function(){ 2041 $(this).toggleClass("on"); 2042 }); 2043 $(".gray-gnb-depth2__item").hover(function(){ 2044 $(this).toggleClass("on"); 2045 }); 2046 2047 $(".btn-search--open2").click(function(){ 2048 $(".search-all-wrap").addClass("on"); 2049 }); 2050 2051 $(".total_search").click(function(){ 2052 $(".search-all-wrap").addClass("on"); 2053 }); 2054 2055 $(".btn-search--close").click(function(){ 2056 $(".search-all-wrap").removeClass("on"); 2057 }); 2058}); 2059 2060/* GNB ìì 24ë 3ì */ 2061let $lastScrollTop = 0; 2062$(window).on('load resize orientationchange scroll', function(){ 2063 const $scrTop = $(this).scrollTop(); 2064 const $contTop = $('#container > div').offset().top; 2065 2066 /*if ($scrTop > $lastScrollTop){ 2067 $('.top_line_bnr').addClass('bnr_hide'); 2068 } else if ($scrTop <= 0) { 2069 $('.top_line_bnr').removeClass('bnr_hide'); 2070 }*/ 2071 2072 if ($scrTop >= ($contTop + 50) && $scrTop >= $lastScrollTop){ 2073 $('.header-wrap').addClass('header_hide'); 2074 } else if ($scrTop < ($contTop + 50)) { 2075 $('.header-wrap').removeClass('header_hide'); 2076 } else { 2077 $('.header-wrap').removeClass('header_hide'); 2078 } 2079 $lastScrollTop = $scrTop; 2080}); 2081var top1 = parseInt($('.search_section.integ_search').css('top')); 2082var top2 = parseInt($('.integSearch_wrap .search_header_wrap').css('top')); 2083$(window).resize(function (){ 2084 top1 = parseInt($('.search_section.integ_search').css('top')); 2085 top2 = parseInt($('.integSearch_wrap .search_header_wrap').css('top')); 2086}); 2087$('.top_flag_info').on('click', function(){ 2088 var top_height = $('.chk_nuri_addr_bnr').innerHeight(); 2089 var header_height = $('.header-wrap').innerHeight(); 2090 if ($(this).hasClass('on')) { 2091 $(this).removeClass('on'); 2092 $('.chk_nuri_addr_bnr').stop().slideUp(); 2093 $('.search_section.integ_search').css('top', top1); 2094 $('.integSearch_wrap .search_header_wrap').css('top', top2); 2095 $(this).children('span').text('ì´ê¸°'); 2096 } else { 2097 $(this).addClass('on'); 2098 $('.chk_nuri_addr_bnr').stop().slideDown(); 2099 $('.search_section.integ_search').css('top', top_height + top1); 2100 $('.integSearch_wrap .search_header_wrap').css('top', top_height + top2); 2101 $(this).children('span').text('ë«ê¸°'); 2102 } 2103}); 2104$('.nl_new_nav > ul > li > a').prop("title","íìë©ë´ ì´ê¸°"); 2105 2106$('.nl_new_nav > ul > li').on('click', function(){ 2107 if ($(this).children().hasClass('on')) { 2108 $(this).find('a').removeClass('on'); 2109 $(this).find('a').prop("title","íìë©ë´ ì´ê¸°"); 2110 subMenuFold(); 2111 } else { 2112 $('.nav_dimm').stop().fadeIn(); 2113 $('body').css({ 2114 'overflow':'hidden' 2115 }); 2116 $('.nl_new_nav > ul > li > a').removeClass('on'); 2117 $('.nl_new_nav > ul > li > a').prop("title","íìë©ë´ ì´ê¸°"); 2118 $(this).find('a').addClass('on'); 2119 $(this).find('a').prop("title","íìë©ë´ ë«ê¸°"); 2120 $('.sub_menu').stop().slideUp(); 2121 const subMenuH = $(this).find('a').siblings('.sub_menu').height(); 2122 $(this).find('a').siblings('.sub_menu').stop().slideDown(); 2123 $('.nl_new_nav_bg').stop().animate({ 2124 'height':subMenuH * 0.7 + 'px' 2125 }); 2126 } 2127}); 2128$('.nav_dimm').on('click', function(){ 2129 subMenuFold(); 2130}); 2131 2132function subMenuFold() { 2133 $('.nav_dimm').stop().fadeOut(); 2134 $('body').css({ 2135 'overflow':'inherit', 2136 'overflow-x':'hidden' 2137 }); 2138 $('.nl_new_nav > ul > li > a').removeClass('on'); 2139 $('.sub_menu').stop().slideUp(); 2140 $('.nl_new_nav_bg').stop().animate({ 2141 'height':'0' 2142 }); 2143} 2144var menu_lyr_flag = true; 2145$('.nl_header_utils > ul > li').on('click', function(){ 2146 if(menu_lyr_flag){ 2147 $(this).children().addClass('on'); 2148 $(this).children().siblings('.func_menus_lyr').show(); 2149 menu_lyr_flag = false;
2150 }else{ 2151 $(this).children().removeClass('on'); 2152 $(this).children().siblings('.func_menus_lyr').hide(); 2153 menu_lyr_flag = true; 2154 } 2155 2156}); 2157/*$(document).on('mouseup', function(e){ 2158 $('.nl_header_utils > ul > li').children().removeClass('on'); 2159 if ($('.func_menus_lyr').has(e.target).length === 0) { 2160 $('.func_menus_lyr').hide(); 2161 }else{ 2162 } 2163});*/ 2164 2165$('.size_sel_list > li, .lang_sel_list > li').on('click', function(){ 2166 $('.size_sel_list > li, .lang_sel_list > li').find('a').removeClass('on'); 2167 $(this).children('a').addClass('on'); 2168}); 2169 2170$('.pers_menus').on('click', function(){ 2171 $(this).children().addClass('on'); 2172 $(this).children().siblings('.pers_menus_lyr').show(); 2173}); 2174$(document).on('mouseup', function(e){ 2175 $('.pers_menus').children().removeClass('on'); 2176 if ($('.pers_menus_lyr').has(e.target).length === 0) { 2177 $('.pers_menus_lyr').hide(); 2178 } 2179}); 2180 2181/*$('.mob_sub_cate_slick').slick({ 2182 accessibility: false, 2183 arrows: false, 2184 dots: false, 2185 autoSlidesToShow: true, 2186 variableWidth: true, 2187 draggable: true, 2188 infinite: false, 2189 autoplay: false, 2190 centerMode: false 2191});*/ 2192 2193$(window).on('load resize', function(){ 2194 const myWinW = $(window).width(); 2195 if (myWinW <= 960) { 2196 $('h3.sub_cont_ttl').addClass('active'); 2197 } else { 2198 $('h3.sub_cont_ttl').removeClass('active'); 2199 } 2200}); 2201$('h3.sub_cont_ttl').on('click', function(){ 2202 if ($(this).hasClass('active')) { 2203 if ($(this).hasClass('open')) { 2204 $(this).removeClass('open'); 2205 } else { 2206 $(this).addClass('open'); 2207 } 2208 $('h3.sub_cont_ttl .sub_cont_ttl_menus').stop().slideToggle(); 2209 } 2210}); 2211$('.mob_btn_berger > a').on('click', function(){ 2212 $('body').css({ 2213 'overflow':'hidden' 2214 }); 2215 $('.header-wrap').addClass('fix'); 2216 setTimeout(function(){ 2217 $('.mob_gnb_wrap').addClass('open'); 2218 }, 300); 2219}); 2220$('.mob_gnb_bg > button').on('click', function(){ 2221 $('body').css({ 2222 'overflow-y':'auto' 2223 }); 2224 $('.header-wrap').removeClass('fix'); 2225 $('.mob_gnb_wrap').removeClass('open'); 2226}); 2227 2228$('.mob_gnb_1depth a').on('click', function(){ 2229 $('.mob_gnb_1depth a').removeClass('on'); 2230 $(this).addClass('on'); 2231}); 2232 2233$('.has_4depth').on('click', function(){ 2234 $(this).siblings('.gnb_4depth_wrap').addClass('open'); 2235}); 2236$('.gnb_4depth_wrap > button').on('click', function(){ 2237 $('.gnb_4depth_wrap').removeClass('open'); 2238}); 2239 2240$('.mob_gnb_menus').scroll(function(e){ 2241 const thisST = $(this).scrollTop(); 2242 const thisInnerH = $(this).innerHeight(); 2243 const thisSH = this.scrollHeight; 2244 const mobGNBTH = $('.mob_gnb_t').innerHeight(); 2245 // console.log('thisST: ' + thisST); 2246 // console.log('thisSH: ' + thisSH); 2247 // console.log('thisInnerH: ' + thisInnerH); 2248 2249 $('.gnb_2depth_each').each(function(i){ 2250 const thisT = $(this).offset().top; 2251 if (thisT - 10 <= mobGNBTH) { 2252 const nowBtn = $('.mob_gnb_1depth a').eq(i).attr('href'); 2253 $('.mob_gnb_1depth a').removeClass('on'); 2254 $('.mob_gnb_1depth a[href="' + nowBtn + '"]').addClass('on'); 2255 } else if (thisST + thisInnerH >= thisSH) { 2256 $('.mob_gnb_1depth a').removeClass('on'); 2257 $('.mob_gnb_1depth ul li:last-child a').addClass('on'); 2258 } 2259 }); 2260}); 2261/* GNB ìì 24ë 3ì end */ 2262 2263/* íµí© ê²ì ë ì´ì´ 24ë 2ì */ 2264$('.prv_menus > ul > li.total_search > a').on('click', function(){ 2265 $("#kwd").val(""); 2266 $('.total_search_pop').stop().fadeIn(); 2267 $('.total_search_tabs .sjtab').focus(); 2268 2269 $('body').css({ 2270 'overflow':'hidden' 2271 }); 2272 2273 $('.nl_header_utils .none_sub:first-child').on('focus', function(){ 2274 $('.total_search_pop > button.close').focus(); 2275 }); 2276 2277 var tsp = document.getElementById("tsp"); 2278 if(tsp.scrollHeight > tsp.clientHeight){ 2279 if($(".btn-detail-search").hasClass("is-open")){ 2280 $(".quick_menu_wrap .quick_btn.on_btn").css("right","100px"); 2281 $(".quick_menu.detail-seachbox").css("right","15px"); 2282 }else{ 2283 $(".quick_menu_wrap .quick_btn.on_btn").css("right","-27px"); 2284 } 2285 } 2286 window.addEventListener("resize", function(){ 2287 if(tsp.scrollHeight > tsp.clientHeight){ 2288 if($(".btn-detail-search").hasClass("is-open")){ 2289 $(".quick_menu_wrap .quick_btn.on_btn").css("right","100px"); 2290 $(".quick_menu.detail-seachbox").css("right","15px"); 2291 }else{ 2292 $(".quick_menu_wrap .quick_btn.on_btn").css("right","-27px"); 2293 } 2294 }else{ 2295 if($(".btn-detail-search").hasClass("is-open")){ 2296 $(".quick_menu_wrap .quick_btn.on_btn").css("right","85px"); 2297 $(".quick_menu.detail-seachbox").css("right","0px"); 2298 }else{ 2299 $(".quick_menu_wrap .quick_btn.on_btn").css("right","-42px"); 2300 } 2301 2302 } 2303 }); 2304}); 2305 2306$('.total_search_pop > button.close').on('click', function(){ 2307 $('.total_search_pop').stop().fadeOut(); 2308 $(".total_search").find("a").focus(); 2309 $('body').css({ 2310 'overflow':'inherit', 2311 'overflow-x':'hidden' 2312 }); 2313}); 2314// íµí©ê²ì ë ì´ì´ ì¼ì ¸ìëê²½ì° ì¤í¬ë¡¤ ë¹êµí´ì quick menu ìì¹ ì®ê¸°ê¸°
2315$(function(){ 2316 2317}); 2318 2319if(!$("#tsp").is(":hidden")){ 2320 console.log("not hidden "); 2321 var tsp = document.getElementById("tsp"); 2322 window.addEventListener("resize", function(){ 2323 console.log("tsp.scrollHeight : " + tsp.scrollHeight); 2324 console.log("tsp.clientHeight : " + tsp.clientHeight); 2325 }); 2326}else{ 2327 console.log("hidden "); 2328} 2329 2330const totalSrchVal = $('.total_srch_pop_input > input').val(); 2331$('.total_srch_pop_input > input').on('change keyup paste', function(){ 2332 if (totalSrchVal === null) { 2333 $('.total_srch_pop_field').removeClass('on'); 2334 } else { 2335 $('.total_srch_pop_field').addClass('on'); 2336 } 2337}); 2338/* íµí© ê²ì ë ì´ì´ 24ë 2ì end */ 2339 2340/* ììí기ì ì 24ë 2ì */ 2341$('.wanted_books_guide > div > strong').on('click', function(){ 2342 if ($(this).hasClass('open')) { 2343 $(this).removeClass('open'); 2344 $(this).siblings('ul').stop().slideUp(); 2345 } else { 2346 $(this).addClass('open'); 2347 $(this).siblings('ul').stop().slideDown(); 2348 } 2349}); 2350/* ììí기ì ì 24ë 2ì end */ 2351 2352/* ë¡ê·¸ì¸ë°©ì ì¤ëª 24ë 2ì */ 2353$('.login_method_tabs button').on('click', function(){ 2354 $('.login_method_tabs button').removeClass('on'); 2355 $('.login_method_tabs button').removeAttr('title'); 2356 $(this).addClass('on'); 2357 $(this).prop('title','ì íë¨'); 2358 2359 if ($(this).hasClass('ordi')) { 2360 $('#login_ordi_mem_guide').show(); 2361 $('#login_orga_mem_guide').hide(); 2362 2363 $('#login_links_ordi').show(); 2364 $('#login_links_orga').hide(); 2365 2366 $('.diff_method_guide').show(); 2367 $('.orga_mem_exp').hide(); 2368 2369 $('.ordi_tel').show(); 2370 $('.orga_tel').hide(); 2371 } else if ($(this).hasClass('orga')) { 2372 $('#login_ordi_mem_guide').hide(); 2373 $('#login_orga_mem_guide').show(); 2374 2375 $('#login_links_ordi').hide(); 2376 $('#login_links_orga').show(); 2377 2378 $('.diff_method_guide').hide(); 2379 $('.orga_mem_exp').show(); 2380 2381 $('.ordi_tel').hide(); 2382 $('.orga_tel').show(); 2383 } 2384}); 2385 2386$('.method_each > button').on('click', function(){ 2387 if ($(this).hasClass('open')) { 2388 $(this).removeClass('open'); 2389 $(this).next('.diff_method_cont').stop().slideUp(); 2390 } else { 2391 $(this).addClass('open'); 2392 $(this).next('.diff_method_cont').stop().slideDown(); 2393 } 2394}); 2395/* ë¡ê·¸ì¸ë°©ì ì¤ëª 24ë 2ì end */ 2396 2397/* footer ìì 24ë 2ì */ 2398$('.relative_org a').on('click', function(){ 2399 $('.relative_org_pop').fadeIn(); 2400 $('.relative_org_pop').attr('tabindex', '0').focus(); 2401 $('body').css({ 2402 'overflow':'hidden' 2403 }); 2404}); 2405$('.relative_org_pop button').on('click', function(){ 2406 $('.relative_org_pop').fadeOut(); 2407 $('body').css({ 2408 'overflow':'inherit', 2409 'overflow-x':'hidden' 2410 }); 2411}); 2412/* footer ìì 24ë 2ì end */ 2413 2414/* LNB ìì 24ë 3ì */ 2415$('.sub_lnb_wrap nav > ul > li > a.has_sub').prop("title","íìë©ë´ ì´ê¸°"); 2416 2417$('.sub_lnb_wrap nav > ul > li > a.has_sub').on('click', function(){ 2418 $(this).prop("title","íìë©ë´ ë«ê¸°"); 2419 $('.sub_lnb_wrap nav > ul > li > a.has_sub').not(this).prop("title","íìë©ë´ ì´ê¸°"); 2420 $('.sub_lnb_wrap nav > ul > li > a.has_sub').not(this).removeClass('open'); 2421 $('.sub_lnb_wrap nav > ul > li > a').not(this).removeClass('opened'); 2422 $('.sub_lnb_wrap nav > ul > li > a.has_sub').not(this).siblings('ul').stop().slideUp(); 2423 if ($(this).hasClass('open')) { 2424 $(this).removeClass('open'); 2425 $(this).prop("title","íìë©ë´ ì´ê¸°"); 2426 $(this).siblings('ul').stop().slideUp(); 2427 } else { 2428 $(this).addClass('open'); 2429 $(this).siblings('ul').stop().slideDown(); 2430 } 2431}); 2432/* LNB ìì 24ë 3ì end */ 2433 2434/* LNB ìì 24ë 6ì ì ê· í¨ì ì¶ê° */ 2435function nowPageByIdNew(fullCode,type){ 2436 var classStr = "active"; 2437 var menuArr = fullCode.toUpperCase().split(">"); 2438 2439 if(type == "SNB2"){ 2440 for(var i in menuArr) { 2441 $("#"+type+"_"+menuArr[i] +" > a").addClass("opened"); 2442 $("#"+type+"_"+menuArr[i] +" > a").trigger("click"); 2443 } 2444 }else if(type == "TAB2" || type == "MTAB2"){ 2445 classStr = "on"; 2446 for(var i in menuArr) { 2447 $("#"+type+"_"+menuArr[i]).addClass("on"); 2448 } 2449 2450 } 2451} 2452/* LNB ìì 24ë 6ì ì ê· í¨ì ì¶ê° end*/ 2453 2454/* 4ëì¤ ì¶ê° 24ë 3ì */ 2455$('.with_depth4').on('click', function(){ 2456 $('.depth_menu_wrap').addClass('open'); 2457}); 2458$('.depth_menu_ttl button').on('click', function(){ 2459 $('.depth_menu_wrap').removeClass('open'); 2460}); 2461/* 4ëì¤ ì¶ê° 24ë 3ì end */ 2462 2463$.fn.gnb1 = function(options) { 2464 var settings = $.extend({ 2465 'actionType': 'click', // ë©ë´ê° ëìíë ì¡ì (mouseenter focusin, click)
2466 'target': '#header', // íì±í ì í´ëì¤ê° ì¶ê°ëë ìì (ê³µëì¼ ê²½ì° ì¤ë²ëë a ë§í¬ ë¶ëª¨ liìë§ í´ëì¤ ì¶ê°ë¨) 2467 'className': 'active', // ì¶ê°í í´ëì¤ëª (targetì ì¶ê°ë¨) 2468 'depth2': '.sub_menu', // ìë¸ë©ë´ 2469 'closeBtn': '.close' // ë«ê¸° ë²í¼ì´ ë³ëë¡ ì¡´ì¬íë ê²½ì° (ë«ê¸° ë²í¼ì í´ë¦ììë§) 2470 }, 2471 options); 2472 2473 return this.each(function() { 2474 var $selecter = $(this); 2475 2476 $selecter.find('a').on(settings.actionType, function() { 2477 if ($(this).parent('li').hasClass('active') == false) { 2478 $(this).parents('li').addClass('active'); 2479 $("#menu-gnb > ul > li > a").find(".sr_only").text("ì´ê¸°"); 2480 $(this).find(".sr_only").text("ë«ê¸°"); 2481 $(this).parents('li').siblings('li').removeClass('active'); 2482 $(this).parents('li').siblings('li').find('li').removeClass('active'); 2483 2484 if (settings.target != '') { 2485 $(settings.target).addClass(settings.className); 2486 } 2487 } else { 2488 if ($(this).next(".sub_menu").length) { 2489 $(this).closest('li').removeClass('active'); 2490 $(this).find(".sr_only").text("ì´ê¸°"); 2491 $(settings.target).removeClass(settings.className); 2492 } 2493 } 2494 2495 if (settings.actionType == 'click') { 2496 if ($(this).next('*').length > 0) { 2497 return false; 2498 } 2499 } 2500 menuH(); 2501 }); 2502 2503 $("#menu-gnb > ul > li > a").on("click", function() { 2504 if (!$(this).closest("li").find(".sub_menu > ul > li").is(".on, .active")) { 2505 $(this).closest("li").find(".sub_menu > ul > li").eq(0).addClass(settings.className); 2506 } else if ($(this).closest("li").find(".sub_menu > ul > li.on").length) { 2507 $(this).closest("li").find(".sub_menu > ul > li").removeClass(settings.className); 2508 $(this).closest("li").find(".sub_menu > ul > li.on").addClass(settings.className); 2509 } 2510 2511 $(this).closest("li").find(".sub_menu > ul > li").each(function() { 2512 if ($(this).hasClass("on")) { 2513 $(this).addClass(settings.className); 2514 } 2515 }); 2516 menuH(); 2517 if ($(this).closest("li").find(".sub_menu").length) { 2518 return false; 2519 } 2520 }); 2521 2522 function menuH() { 2523 let d2H = 0; 2524 let d3H = 0; 2525 d2H = $(".topmenu").find("> li.active .sub_menu").innerHeight() + 50; 2526 d3H = $(".topmenu").find("> li.active .sub_menu .active .dep3").innerHeight(); 2527 //alert("d2H : " + d2H + " d3H : " + d3H); 2528 if (d2H < d3H) { 2529 $(".topmenu").find("> li.active .sub_menu").removeAttr("style"); 2530 $(".topmenu").find("> li.active .sub_menu").height(d3H); 2531 } 2532 //$(".topmenu").find("> li.active .sub_menu").height(d2H * 0.7); 2533 } 2534 2535 if ($selecter.find(settings.closeBtn).length == 1) { 2536 $selecter.find(settings.closeBtn).on('click', function() { 2537 $selecter.find('li').removeClass(settings.className); 2538 $("#menu-gnb > ul > li > a").find(".sr_only").text("ì´ê¸°"); 2539 $(settings.target).removeClass(settings.className); 2540 2541 return false; 2542 }); 2543 } else { 2544 // ë§ì°ì¤ ìì 2545 /*let cursorY; 2546 $(document).on('click', function (e) { 2547 console.log("className = " + $(e.target).parent().getAttribute("class")); 2548 console.log("className = " + e.target.className); 2549 cursorY = e.pageY; 2550 if ($selecter.find('li.active').length > 0) { 2551 if (cursorY > parseInt($selecter.find(settings.depth2).offset().top + $selecter.find('.active').find(settings.depth2).innerHeight())) { 2552 if (cursorY > parseInt($(".top_line_bnr").height() + $(".header-wrap").height() + $
2552selecter.find('.active').find(settings.depth2).innerHeight())) { 2553 setTimeout(function () { 2554 //closeMenu(); 2555 }, 200); 2556 } 2557 } 2558 } 2559 });*/ 2560 2561 $("#menu-gnb .sub_menu").on("mouseleave",function(){ 2562 //closeMenu(); 2563 }); 2564 2565 $(document).on("click", function(e) { 2566 if (!$(e.target).parents().is(".topmenu") || $(e.target).is(".sub_menu")) { 2567 closeMenu(); 2568 } 2569 }); 2570 } 2571 2572 function closeMenu() { 2573 /*alert($selecter.attr("className"));*/ 2574 $selecter.find('li').removeClass(settings.className); 2575 $("#menu-gnb > ul > li > a").find(".sr_only").text("ì´ê¸°"); 2576 $(settings.target).removeClass(settings.className); 2577 } 2578 2579 // í ìì 2580 window.addEventListener("keyup", (e) => { 2581 if (!e.target.closest("#menu-gnb")) { 2582 //closeMenu(); 2583 } 2584 }); 2585 2586 /* $selecter.find('a:last').keydown(function (e) { 2587 if (e.keyCode === 9) { 2588 $selecter.find('li').removeClass(settings.className); 2589 $(settings.target).removeClass(settings.className); 2590 } 2591 }); */ 2592 2593 // ìí ìì 2594 $selecter.find('a:first').keydown(function(e) { 2595 if (e.keyCode === 9 && e.shiftKey) { 2596 //closeMenu(); 2597 } 2598 }); 2599 }); 2600}; 2601 2602// GNB ë©ë´ íìë©ë´ ìëì§ íì¸ 2603$("#menu-gnb li a").each(function() { 2604 const t = $(this); 2605 2606 if (t.next().length) { 2607 t.closest("li").addClass("plus"); 2608 } 2609}); 2610 2611$("#menu-gnb .sub_menu > ul > li").eq(0).each(function() { 2612 $(this).addClass("active"); 2613}); 2614 2615$("#menu-gnb").gnb1(); 2616// íµí©ê²ì ë ì´ì´íì í ì¶ê° 20250320 JSH 2617/*$('.total_search_tabs button').on('click', function(){ 2618 $('.total_search_tabs button').removeClass('on'); 2619 $(this).addClass('on'); 2620 var pr_plus = parseInt($(".total_srch_pop_input > .btn_sch").css("width")) + parseInt($(".total_srch_pop_input").css("padding-left")); 2621 if ($(this).hasClass('sjtab')) { // ìì¥ìë£ 2622 $("#worldWordPC").show(); 2623 var pr = 0; 2624 if ($(window).width() > 960){ 2625 pr = 242; 2626 }else if($(window).width() < 961 && $(window).width() > 640){ 2627 pr = 180; 2628 }else{ 2629 pr = 145; 2630 } 2631 $(".total_srch_pop_input").css("padding-right", pr); 2632 } else if ($(this).hasClass('hmtab')) { // ííì´ì§ 2633 $("#worldWordPC").hide(); 2634 $(".total_srch_pop_input").css("padding-right", pr_plus + 10); 2635 } 2636});*/ 2637 2638function srOnlyTab(e){ 2639 if($(e.target).is("class") && $(e.target).attr("class").indexOf("tab") > -1){ //tabì ì¶ê° 2640 /*alert($(e.target).attr("class"));*/ 2641 $('.sr-only.tab').each(function(){ 2642 $(this).remove(); 2643 }); 2644 console.log($(e.target).attr("class")); 2645 $(e.target).append('<span class="sr-only tab">ì íë¨</span>') 2646 } 2647}
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.