$(function(){ //공통상단메뉴(헤더) $('.gnb_nav .menu').mouseenter(function(){ $(this).find('.gnb_depth2').slideDown(100); }) .mouseleave(function(){ $(this).find('.gnb_depth2').hide(); }); var currentScrollTop = 0; window.onload = function() { scrollController(); $(window).on('scroll', function() { scrollController(); }); } function scrollController() { currentScrollTop = $(window).scrollTop(); if (currentScrollTop < 0.1) { $('#header').css('top', 0.1-(currentScrollTop)); if ($('#header').hasClass('scrollDown')) { $('#header').removeClass('scrollDown'); } } else { if (!$('#header').hasClass('scrollDown')) { $('#header').css('top', 0); $('#header').addClass('scrollDown'); } } } //모바일 메뉴 $('.m_btn_box label').click(function(){ $('.mo_gnb').toggleClass('active'); $('.mo_gnb .depth2').slideUp(); $('.mo_gnb .depth1 > ul > li').removeClass('active'); }); $('.depth1 > a').click(function(e){ e.preventDefault(); if($(this).parent('li').hasClass('active')){ $('.depth1').removeClass('active'); $(this).siblings('.depth2').slideUp(300); }else{ $('.mo_gnb .depth2').slideUp(300); $(this).siblings('.depth2').slideDown(300); $('.depth1').removeClass('active'); $(this).parent('li').addClass('active'); }; }); //WOW.js new WOW().init(); //상단 버튼 $("#go-top").hide(); $(function () { $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('#go-top').fadeIn(); } else { $('#go-top').fadeOut(); } }); $('#go-top a').click(function () { $('body,html').animate({ scrollTop: 0 }, 800); return false; }); }); });