$(document).ready(function(){ /* gnb */ $('.gnb > li , .gnb-bg').mouseenter(function(){ $('.gnb-bg').stop().show().animate({height:'220px'}); $('.sub').stop().show().animate({height:'220px'}); }); $('.gnb, .gnb-bg').mouseleave(function(){ $('.gnb-bg').stop().animate({height:'0px'},500,function(){ $('.gnb-bg').hide(); }); $('.sub').stop().animate({height:'0px'},function(){ $('.sub').hide(); }); }); $('.gnb > li').mouseenter(function(){ $(this).addClass('on').siblings().removeClass('on'); }); $('.gnb > li').mouseleave(function(){ $(this).removeClass('on'); }); /* 모바일 메뉴 */ $('.m-gnb-btn').click(function(){ var t_height = $(document).height(); $('.m-gnb-wrap').animate({right:'0'}); $('.m-gnb-bg').css({opacity:'0.5',display:'block'}); $('html,body').css('overflow','hidden'); $('.footer').css({'z-index':0}); }); $('.m-cancel-btn').click(function(){ $('.m-gnb-wrap').animate({right :'-380px'}, function(){ $('.footer').css({'z-index':1}); }); $('.m-gnb-bg').css({opacity:'0',display:'none'}); $('html,body').css('overflow','visible'); }); /* 아코디언 */ $('.m-gnb-wrap .m-navi > li > a , .m-gnb-wrap .arrow').click(function(){ $(this).parent().toggleClass('on').find('.m-sub').slideToggle().end().siblings().removeClass('on').end().siblings().find('.m-sub').slideUp(); return false; }); var hei = $('#header').outerHeight(); var scroll = $(document).scrollTop(); $(window).scroll(function(){ scroll = $(document).scrollTop(); if (scroll >= hei) { $('#header').addClass('fixed'); $('#real_contents').css('padding-top','140px'); } else { $('#header').removeClass('fixed'); $('#real_contents').css('padding-top','0px'); } }); });