$(function() { page.init(); }); var page = { init: function() { //°øÅë page.common(); }, common: function() { //bg cover $(".bg_cover > .bg_img").each(function() { $(this).parent().css("background-image","url(" + $(this).attr("src") + ")"); }); //gnb hover var gnbHeader = $("#header .header_main"); $("#gnb").hover( function() { gnbHeader.addClass("active").stop(true,true).animate({ height:250 }, 200); }, function() { gnbHeader.stop(true,true).animate({ height:50 }, 200, function() { $(this).removeClass("active"); }); } ); $("#gnb .menu").hover( function() { $(this).addClass("hover"); }, function() { $(this).removeClass("hover"); } ); //gnb mobile ¸Þ´º var headerGnbWrap = $("#header .gnb_wrap"); var headerGnb = $("#gnb"); $("#header .btn_menu").on("click", function() { headerGnbWrap.stop(true,true).css("opacity",0).show().animate({ opacity:1 }, 200); headerGnb.stop(true,true).animate({ right:0 },200); return false; }); var headerClose = $("#header .btn_close").on("click", function() { headerGnbWrap.stop(true,true).animate({ opacity:0 }, 200, function() { $(this).hide(); }); headerGnb.stop(true,true).animate({ right:-270 },200); return false; }); $("#gnb .link").on("click", function() { if(headerClose.is(":visible")) { var getMenu = $(this).parent(); if(getMenu.hasClass("active")) { getMenu.removeClass("active").find(".sub_menu").stop(true,true).slideUp(200); } else { $("#gnb .menu.active").removeClass("active").find(".sub_menu").stop(true,true).slideUp(200); getMenu.addClass("active").find(".sub_menu").stop(true,true).slideDown(200); } return false; } }); //top ¸Þ´º var btnTop = $("#btn_top").on("click", function() { $("html,body").stop(true,true).animate({ scrollTop:0 }, 300); return false; }); $(window).on("scroll", function() { var getScrollTop = $(window).scrollTop(); if(getScrollTop > 100) { btnTop.addClass("on"); } else { btnTop.removeClass("on"); } }); }, main: function() { if($("#main_special").length == 0) return; } }