(function($){ $.fn.dropdown = function(){ return this.each(function(){ var $gnb = $(this), $menu = $gnb.find(".menu"), $depth1 = $gnb.find(".depth1"), $depth2 = $gnb.find(".depth2"); $gnb.mouseenter(function(){ gnbOn(); }).mouseleave(function(){ gnbOff(); }); $gnb.find("a").focusin(function(){ gnbOn(); }).focusout(function(){ gnbOff(); }); function gnbOn(){ $gnb.find($depth2).stop().animate({height: "250"});/*서브메뉴 높이 조절*/ } function gnbOff(){ $gnb.find($depth2).stop().animate({height: "0"}); } }); } })(jQuery); // $(function(){ // $('.menu').on('mouseenter focus',function(){ // $('.menu').find('.depth2').show(); // $('.menu').find('.depth2').stop().animate({height:"250px"}); // // $(this).next('.depth2').fadeIn(200); // // $(this).next('.depth2').css('z-index','2'); // }); // // $('.depth2').on('mouseleave blur',function(){ // // $('.depth2').fadeOut(100); // // }); // // }); $(function(){ $(".dropdown").dropdown(); }); /*전체메뉴*/ // $('#toggle').click(function(){ // $(this).toggleClass('on'); // if($(this).hasClass('on')){$('.gnb').slideDown(200);} // else{$('.gnb').slideUp(200);} // }); // $('.depth1').on('click',function(){ // $(this).next('.depth2').slideDown(200); // }); $('a[href="#"]').click(function(e) { e.preventDefault(); }); $('#toggle').click(function() { $(this).toggleClass('active'); $('#overlay').toggleClass('open'); }); $('.depth1').on('click',function(){ $('.depth2').slideUp(200); $(this).toggleClass('on'); if($(this).hasClass('on')){$(this).next('.depth2').slideDown(200);} else{$(this).next('.depth2').slideUp(200);} }); $('.dropdown').hover(function() { $('#logo').toggleClass('logo_on'); });