$(function(){ var time = 500; var method='easeOutQuint' var imgOver = false; var menuOpa = '0.6' /* 소분류 메뉴 투명도 조절*/ $('#gnb_menu_inner li img').css('opacity',menuOpa) // 초기 메뉴open 여부 // objMenu = "#gnb li img, #gnb_menu_inner li img, #gnb_menu_inner li a, #gnb_menu_inner"; objMenu = "#gnb li, #gnb_menu_inner li img, #gnb_menu_inner li a, #gnb_menu_inner"; objMenu2 = "#gnb li img, #gnb_menu_box li img, #gnb_menu_box li a, #gnb_menu_box"; objMenu3 = "#gnb_wrap"; $(objMenu).on('mouseover',function(event){ clearTimeout(imgOver); // $('#gnb_menu').css('height',$('#gnb_menu_inner').outerHeight()); $('#gnb_menu').css('height',$('#gnb_menu_box').outerHeight()); $('#gnb_menu_box').stop(true).animate({ top:'0px' }, time, method ); $('.gnb_open').hide(); }); $(objMenu).on('click',function(event){ clearTimeout(imgOver) $('#gnb_menu').css('height',$('#gnb_menu_box').outerHeight()); $('#gnb_menu_box').stop(true).animate({ top:'0px' }, time, method ); $('.gnb_open').hide(); }); $(objMenu3).on('mouseleave',function(event){ imgOver = setTimeout( function (){ $('#gnb_menu_box').stop(true).animate({ top:'-250px' }, time, method,function(){$('#gnb_menu').css('height',0);} ); $('.gnb_open').show(); },100); }); $('.gnb_close').click(function(event) { $('#gnb_menu_box').stop(true).animate({ top:'-250px'}, time, method,function(){$('#gnb_menu').css('height',0);} ); $('.gnb_open').show(); }); $('#gnb_menu_inner li img').hover( function(){$(this).stop(true).animate({opacity:'1'},500);}, function(){$(this).stop(true).animate({opacity:menuOpa},500)} ); $('.gnb_open').click(function(event){ clearTimeout(imgOver); $('#gnb_menu').css('height',$('#gnb_menu_box').outerHeight()); $('#gnb_menu_box').stop(true).animate({ top:'0px' }, time, method ); // $(this).fadeOut(200); $(this).hide(); }); //------------- if ( $('img').hasClass('active') ){ $('img.active').attr('src', $('img.active').attr('img2')); } $('img.rollover').mouseover(function(){ if ( !$(this).hasClass('active') ){ $(this).attr('src', $(this).attr('img2')); } }).mouseout(function(){ if ( !$(this).hasClass('active') ){ $(this).attr('src', $(this).attr('img1')); } }); });