$(function () { !function e() { let t = document.getElementById("isIndex"); if (t && "Y" == t.value) { document.getElementById('sjs').remove(); document.getElementById('scss').remove(); } else { document.getElementById('mjs').remove(); document.getElementById('mcss').remove(); } }(); /* 패밀리 사이트 새창열기 */ $("#family-sites").on("change", function(e){ window.open(e.target.value, "_blank"); }); /* PC 헤더 메뉴 스크립트 */ const header = $("#header"); const gnbItem = $('#header .gnb-nav li'); const gnbNav = $('#header .gnb-nav'); const bgMaxHeight = $(".nav-sub").outerHeight(); $(".nav-3depth").height(0); const bgHeight = $(".nav-sub").outerHeight(); gnbItem.on('mouseenter', function() { if (header.hasClass('active')) { return; } header.addClass('active'); gsap.to('#header .nav-sub-bg', { autoAlpha: 1, height: 200, duration: 0.3 }); $('#header .nav-sub').stop().fadeIn(400); }); gnbNav.on('mouseleave', function() { header.removeClass('active'); $(".nav-3depth").height(0); $('#header .nav-sub').stop().fadeOut(100); gsap.to('#header .nav-sub-bg', { autoAlpha: 0, height: 0, duration: 0.3 }); }); /* 3depth 메뉴 */ $("#header .gnb-nav .nav-sub > li > a").on("click", function(e){ let child = $(this).next(".nav-3depth"); if (child.length == 0) {return;} if (child.height() == 0) { gsap.to(child, { height: "auto", duration: 0.3 }); gsap.to('#header .nav-sub-bg', { autoAlpha: 1, height: bgMaxHeight, duration: 0.3 }); } else { gsap.to(child, { height: 0, duration: 0.3 }); gsap.to('#header .nav-sub-bg', { autoAlpha: 1, height: bgHeight, duration: 0.3 }); } }); /* 스크롤 시 이벤트 */ $(window).on('scroll', function() { let st = $(window).scrollTop(); if ( st >= 100 ) { header.addClass('sticky'); $("#quick-btns").addClass('show'); } else { header.removeClass('sticky'); $("#quick-btns").removeClass('show'); } }); /* 모바일 헤더 메뉴 스크립트 */ const mbHeader = $("#header-mb"); const mbSubMenu = $("#header-mb .nav-sub .sub-menu"); const mbGnbMenu = $("#header-mb .gnb-nav a"); $("#header-mb .gnb-nav a").on("click", function(e){ var idx = $(e.target).closest("p").index(); mbSubMenu.removeClass("on"); mbSubMenu.eq(idx).addClass("on"); mbGnbMenu.removeClass("on"); mbGnbMenu.eq(idx).addClass("on"); }); $("#header-mb .sub-menu > p").on("click", function(e){ let child = $(this).next(".mb-nav-3depth"); if (child.length == 0) { return; } if (child.height() == 0) { gsap.to(child, { height: "auto", duration: 0.3 }); } else { gsap.to(child, { height: 0, duration: 0.3 }); } }); $(".gnb-hamburger").on('click', (e) => { let $this = $(e.currentTarget); mbHeader.stop().fadeToggle(400); $this.toggleClass('close'); }); function loaded_script() { // hide spinner let t = $("#page-loader"); t.find(".loader-stage").fadeOut("slow", function() { setTimeout(function() { t.fadeOut("slow"); }, 100); }); // sub page hero init if (document.getElementById("isIndex")!=null) { let hero = $('.hero'); hero.addClass('--load'); } } window.onload = loaded_script(); });