//gnb var gnb = (function($){ //gnbWeb var _web = function(level1){ var $header, $depth2, $depth3, isOpen; $header = $("#header"); $depth2 = $(".gnb_w ul.depth2"); $depth3 = $(".gnb_w ul.depth3"); $(".gnb_w>ul>li.mNavi" + level1).addClass("active"); $(".gnb_w").on({ "mouseenter":function(){ isOpen = false; setTimeout(gnbView, 100); }, "mouseleave":function(){ isOpen = true; setTimeout(gnbView, 600); } }); $(".gnb_w li a").on({ "focusin":function(){ isOpen = false; setTimeout(gnbView, 100); }, "focusout":function(){ isOpen = true; setTimeout(gnbView, 100); } }); $(".gnb_w>ul>li").on({ "mouseenter":function(){ $(this).siblings("li").removeClass("on"); $(this).addClass("on"); }, "mouseleave":function(){ $(".gnb_w>ul>li").removeClass("on"); } }); $depth2.children("li").children("a").on({ "mouseenter":function(){ TweenMax.to($(this), 0.25, {css:{color:"#ff8a00"}, ease:Cubic.easeOut}); }, "mouseleave":function(){ TweenMax.to($(this), 0.25, {css:{color:"#74676f"}, ease:Cubic.easeOut}); } }); $depth3.children("li").children("a").on({ "mouseenter":function(){ TweenMax.to($(this), 0.25, {css:{color:"#ff8a00"}, ease:Cubic.easeOut}); }, "mouseleave":function(){ TweenMax.to($(this), 0.25, {css:{color:"#888888"}, ease:Cubic.easeOut}); } }); function gnbView(){ if(!isOpen){ TweenMax.to($header, 0.2, {css:{className:"+=on"}}); $depth2.show(); TweenMax.to($depth2, 0.3, {css:{opacity:1}, delay:0.1}); }else{ TweenMax.to($header, 0.2, {css:{className:"-=on"}}); $depth2.hide(); TweenMax.to($depth2, 0.3, {css:{opacity:0}, delay:0.1}); } } }; //gnbMobile var _mobile = function(){ var $menu = $(".gnb_m>li>a"); $menu.on("click", function(){ if($(this).hasClass("on")){ $(this).removeClass("on"); $(this).siblings("ul").slideUp(100); }else{ $menu.removeClass("on"); $(".gnb_m>li>ul").slideUp(100); $(this).addClass("on").siblings("ul").slideDown(100); } }); }; return { web:_web, mobile:_mobile } })(jQuery); var subFunc = (function($){ var _init = function(){ $(window).on("load scroll", function(){ if($(this).scrollTop() < 361){ TweenMax.to($(".sub_bg"), 0.7, {css:{"background-position-y":$(this).scrollTop()*0.27+"%"}, ease:"Cubic.easeOut"}); } if($(this).scrollTop() > 1){ $("#go_top").fadeIn(100); }else{ $("#go_top").hide(); } }); //language var $langBtn = $("a.lang_default"); var closeF; $langBtn.on("click", function(){ if($(this).hasClass("on")){ langClose(); }else{ $(this).addClass("on").siblings(".lang_other").css("display","block"); } }); $("div.language").on({ "mouseleave":function(){ closeF = setTimeout(langClose, 500); }, "mouseenter":function(){ clearTimeout(closeF); } }); function langClose(){ $langBtn.removeClass("on"); $("a.lang_other").css("display","none"); } //share button $("div.share_area").on({ "mouseenter focusin":function(){ TweenMax.to($(".share_icon"), 0.2, {css:{className:"+=on", "display":"block"}}); }, "mouseleave":function(){ TweenMax.to($(".share_icon"), 0.01, {css:{className:"-=on", "display":"none"}}); } }); }; //snb var _snb = function(level1, level2){ var $openDepth = $(".snb a.open_depth"); var $link = $(".snb .menu a"); $(".snb>.depth1_area>a.open_depth").text($(".snb>.depth1_area .submenu" + level1).text()); $(".snb>.depth2_area>a.open_depth").text($(".snb>.depth2_area .submenu" + level2).text()); $openDepth.on("click", function(){ var $this = $(this); if($this.hasClass("on")){ $this.removeClass("on"); $this.siblings("ul.menu").slideUp(100); }else { $this.addClass("on"); $this.siblings("ul.menu").slideDown(200); } }); $(".snb>div").on("mouseleave", function(){ if($(this).children("a.open_depth").hasClass("on")){ $(this).children("a.open_depth").removeClass("on"); $(this).children("ul.menu").slideUp(100); } }); }; return{ init:_init, snb:_snb } })(jQuery); $(function(){ $(".go_top").on("click", function(e){ e.preventDefault(); $("body, html").stop().animate({scrollTop:0}, 400); }); gnb.mobile(); subFunc.init(); }); // JavaScript Document