/* * Name: KEPCO * Part: JavaScript for ui & plug-in */ (function($){ // jQuery.noConfict(); $(document).ready(function() { /* * Part: 서포터즈 GNB * Function: * * */ var current = -1; //단별메인,서브GNB $('#gnb ul.nav > li').on('mouseenter focusin',function (event) { var index = $(this).index() + 1; if(event.type == 'mouseenter' || event.type == 'focusin' ) //20150319 오대영 수정 activateMenu(index); current = index; }).on('mouseleave focusout',function (event) { var index = $(this).index() + 1; deactivateMenu(index); }); $('.dep_bg').on('mouseenter', function(){ $('.dep_bg').stop(true, false).animate({'height':37}, 200, null); }).on('mouseleave', function(){ $('.dep_bg').stop(true, false).animate({'height':0}, 200, null); }); function activateMenu(index){ $('#gnb ul.nav > li').eq(index-1).find('a').addClass('current'); $('#gnb ul.nav > li a.current + ul, .dep_bg').stop(true, false).animate({'height':37}, 200, null); //$('.dep2_bg').addClass('bg0' + index); //$('ul.gnb > li').eq(index-1).find('ul').addClass('on'); } function deactivateMenu(index){ $('#gnb ul.nav > li').eq(index-1).find('a').removeClass('current'); $('#gnb ul.nav > li ul, .dep_bg').stop(true, false).animate({'height':0}, 200, null); //$('.dep2_bg').removeClass('bg0' + index); //$('ul.gnb > li').eq(index-1).find('ul').removeClass('on'); } });//end : document ready })(jQuery);