/* * Name : common.css * Version : 1.0 * Author : 1px studio * Date : 2023.07.19 * Desc : - --------------------------------------------------- */ $(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 */ $("#header .mb-gnb-open").on("click", function(e){ $("#header-mb").addClass("open"); }); $("#header-mb .mb-gnb-close").on("click", function(e){ $("#header-mb").removeClass("open"); }); $("#header-mb .gnb-font").on("click", function(e){ $(this).next(".gnb-sub").slideToggle(); $(this).closest("li").toggleClass("open"); }); $("#header-mb").on("click", function(e){ if (!$(e.target).is(".gnb") && !$(e.target).is(".gnb *")) { $("#header-mb .mb-gnb-close").trigger("click"); } }); /* 스크롤 시 이벤트 */ $(window).on('scroll', function() { let st = $(window).scrollTop(); let header = $("#header"); if ( st >= 100 ) { header.addClass('fixed'); } else { header.removeClass('fixed'); } if (st >= 200) { $("#quick-btns").addClass('show'); } else { $("#quick-btns").removeClass('show'); } }); /* 커스텀 커서 */ function custom_cursor() { let isMobile = /Mobi/i.test(window.navigator.userAgent); if (isMobile) { $(".px-cursor").remove(); return; } const $ball = document.querySelector('.cursor-ball'); $(document).on('mousemove', onMouseMove); $(document).on("mouseenter", "a, button", onMouseHover); $(document).on("mouseleave", "a, button", onMouseHoverOut); $('.cursor-area').on("mouseenter", onMouseHover2); $('.cursor-area').on("mouseleave", onMouseHoverOut2); function onMouseMove(e) { TweenMax.to($ball, .6, { x: e.clientX - 15, y: e.clientY - 15 }); } function onMouseHover() { TweenMax.to($ball, .3, { scale: 0.18 }); } function onMouseHoverOut() { TweenMax.to($ball, .3, { scale: 0.34 }); } function onMouseHover2(e) { TweenMax.to($ball, .3, { scale: 1 }); let cursor_txt = $(e.target).attr('data-cursor'); $($ball).css({"mix-blend-mode": "unset", "opacity" : 0.8}); $($ball).find("circle").css({"fill": "var(--primary)"}); $($ball).append("
"+cursor_txt+"
"); } function onMouseHoverOut2() { TweenMax.to($ball, .3, { scale: 0.34 }); $($ball).css({"mix-blend-mode": "difference", "opacity" : 1}); $($ball).find("circle").css({"fill": "var(--primary-blend)"}); $($ball).find(".text").remove(); } } custom_cursor(); // language click. (keep current page) $(".gnb-lang-btn a, .gnb-lang-mobile").on("click", function(e){ let isEng = $(this).hasClass("ko") ? false : true; let route = location.pathname.split("/").filter((b) => { return b!="" && b!="page" && b!="en"; }); let isRoot = false; let md = ""; if (location.href.match("/bizdemo") || location.href.match("/default")) { md = "/"+route[0]; isRoot = route.length == 1 ? true : false; route = route.slice(1, route.length); } else { isRoot = route.length == 0 ? true : false; } location.href = location.origin + md+"/"+(isEng ? "en/": (isRoot ? "" : "page/"))+route.join("/"); }); });