$(function(){ /* PRIME COMMON : s */ !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(); } }(); 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(); /* PRIME COMMON : e */ let $menu = { isOpen: false, isAnimating: false, header: "#header", nav: "#nav", navMask: ".nav-mask", imgWrap: "#nav .img-wrap", imgWrapMask: "#nav .img-wrap .mask", menuTexts: "#nav .menu .mask > *", snsIcons: "#nav .contact .sns a", cTexts: "#nav .c-text", imgWidth: "566px", menuBtnBar1: ".menu-btn .bar-1", menuBtnBar2: ".menu-btn .bar-2", logo: "#header .gnb-logo svg", blackColor: "#373C45", whiteColor: "#ffffff" } $("#header .menu-btn").on("click", function(){ if (!$menu.isOpen) { if ($menu.isAnimating) { return; } $menu.isAnimating = true; gsap.to($menu.menuBtnBar1, { rotation: "45deg", y: "3px", backgroundColor: $menu.blackColor, duration: 1, ease: "expo.inOut", delay: 0.1 }); gsap.to($menu.menuBtnBar2, { rotation: "-45deg", y: "-4px", backgroundColor: $menu.blackColor, duration: 1, ease: "expo.inOut", delay: 0.1 }); gsap.set($menu.navMask, { display: "block" }); gsap.to($menu.navMask, {opacity: 0.85, duration: 3, ease: "power2.out"}); gsap.to($menu.nav, {bottom: "0%", duration: 0.95, delay: 0.4, ease: "power2.out"}); gsap.to($menu.imgWrap, {width: $menu.imgWidth, duration: 0.6, delay: 0.85, ease: "power2.out"}); gsap.to($menu.imgWrapMask, {width: $menu.imgWidth, duration: 0.75, delay: 1, ease: "power2.out"}); gsap.to($menu.menuTexts, {transform: "translateY(0px)", duration: 0.6, delay: 0.85, stagger: 0.02, ease: "power2.out"}); gsap.to($menu.snsIcons, {opacity: 0.4, duration: 0.6, delay: 1, stagger: 0.05, ease: "power2.out"}); gsap.to($menu.cTexts, {opacity: 0.4, duration: 0.6, delay: 1.2, stagger: 0.05, ease: "power2.out"}); gsap.to($menu.logo, {fill: $menu.blackColor, duration: 0.6, ease: "power2.out"}); $menu.isAnimating = false; $menu.isOpen = true; } else { gsap.to($menu.menuBtnBar2, { rotation: "0deg", y: 0, backgroundColor: $menu.blackColor, duration: 1, ease: "expo.inOut", delay: 0 }); gsap.to($menu.menuBtnBar1, { rotation: "0deg", y: 0, backgroundColor: $menu.blackColor, duration: 1, ease: "expo.inOut", delay: 0 }); gsap.to($menu.menuTexts, {transform: "translateY(30px)", duration: 0.9, ease: "power2.out"}); gsap.to($menu.snsIcons, {opacity: 0.0001, duration: 0.6, ease: "power2.out"}); gsap.to($menu.cTexts, {opacity: 0.0001, duration: 0.6, ease: "power2.out"}); gsap.to($menu.imgWrapMask, {width: 0, duration: 0.6, ease: "power2.out"}); gsap.to($menu.imgWrap, {width: 0, duration: 0.8, ease: "power2.out"}); gsap.to($menu.nav, {bottom: "100%", duration: 0.6, delay: 0.4, ease: "power2.out"}); gsap.to($menu.navMask, {opacity: 0.0001, duration: 2, ease: "sine.out"}); gsap.to($menu.logo, {fill: $menu.blackColor, duration: 0.6, delay: 0.4, ease: "power2.out"}); gsap.set($menu.navMask, { display: "none", delay: 2, onComplate: () => { $menu.isAnimating = false; $menu.isOpen = false; menuImageChange(0); } }); } }); $(window).on("scroll", function() { let st = $(window).scrollTop(); let header = $("#header"); let isIndex = document.getElementById("isIndex"); let fixPoint = isIndex ? window.innerHeight-110 : 200; if (st >= fixPoint) { header.addClass('fixed'); } else { header.removeClass('fixed'); } if (st >= 200) { $("#quick-btns").addClass('show'); } else { $("#quick-btns").removeClass('show'); } }); $("#nav .menu .n-sub").on("mouseover", function(e){ let subIdx = $(this).data("sub"); menuImageChange(subIdx); }); function menuImageChange(idx) { $("#nav .img-wrap img").removeClass("show"); $("#nav .img-wrap img").eq(idx).addClass("show"); } });