(function(){ InitTopMenu = { _queue : true, _duration : 300, init : function(id) { $menuLi_el = $("#"+id+">li"); $coverLayer = $("#"+id).parent().parent(); $menuLi_el.find(">a").mouseenter(function(){ InitTopMenu.menu_open($(this)); }).focusin(function() { $(this).mouseenter(); }); $('a.subNav-close').focusout(function() { InitTopMenu.menu_close($(this)); }); $('a.subNav-close').click(function() { InitTopMenu.menu_close($(this)); return false; }); $coverLayer.mouseleave(function() { InitTopMenu.menu_close($(this)); }); }, menu_open : function(el) { var animatedObj = $("div.subNavwp:animated"); animatedObj.stop(); var fromHeight = $("div.subNavwp:visible").length>0?$("div.subNavwp:visible").height():0; var toheight = el.next().children("div.subNavbox").outerHeight(); $("div.subNavwp").hide(); el.next().css("height", fromHeight +"px"); el.next().show(); el.next().find("div.snleft").css("height", toheight +"px"); el.next().animate({height: toheight +"px"},{queue: this._queue, duration: this._duration, complete: function() {} }); $coverLayer.css("height", (toheight + 104) +"px"); }, menu_close : function(el) { $("div.subNavwp:visible").animate({height: 0},{queue: this._queue, duration: this._duration, complete: function() { $("div.subNavwp").hide(); } }); $coverLayer.css("height", "104px"); } } })(); $(document).ready(function() { $('div.subNavwp').each(function () { $(this).css("overflow", "hidden"); $(this).children('div.subNavbox').height($(this).height()); $(this).find('div.snleft').height($(this).height()); }); InitTopMenu.init("gnb_menu"); $("ul.snb_wrap > li").each(function () { if ($(this).children("a").hasClass("hv") && $(this).children("ul").length > 0 && !$(this).children("ul").hasClass("on")) { $(this).bind("mouseenter", function () { $(this).css("overflow", "hidden"); var animatedObj = $("ul.snb_wrap > li:animated"); animatedObj.stop(); animatedObj.height($(this).children("a").outerHeight()); var toHeight = $(this).children("a").outerHeight() + $(this).children("ul").height() +1; //$(this).children("ul").css("display", "block"); $(this).animate({ height: toHeight +"px" }, { queue: true, duration: 300 } ); }); $(this).children("a").bind("focusin", function () { $(this).parent().css("overflow", "hidden"); var animatedObj = $("ul.snb_wrap > li:animated"); animatedObj.stop(); animatedObj.height($(this).outerHeight()); var toHeight = $(this).outerHeight() + $(this).parent().children("ul").height() +1; //$(this).children("ul").css("display", "block"); $(this).parent().animate({ height: toHeight +"px" }, { queue: true, duration: 300 } ); }); $(this).bind("mouseleave", function () { //$("ul.snb_wrap > li:animated").height(toHeight); //$("ul.snb_wrap > li:animated").stop(); if ($(this).is(":animated")) { $(this).stop(); } var toHeight = $(this).children("a").outerHeight(); $(this).animate({ height: toHeight +"px" }, { queue: true, duration: 100, complete: function() { //$(this).children("ul").css("display", "none"); } } ); }); /* $(this).children("a").last().bind("focusout", function () { //$("ul.snb_wrap > li:animated").height(toHeight); //$("ul.snb_wrap > li:animated").stop(); if ($(this).is(":animated")) { $(this).stop(); } var toHeight = $(this).children("a").outerHeight(); $(this).animate({ height: toHeight +"px" }, { queue: true, duration: 100, complete: function() { //$(this).children("ul").css("display", "none"); } } ); }); */ } }); if ($('#monthList').length > 0) { $('#monthList > ul > li').each(function () { $(this).children("a").bind("focusin", function () { $('#monthList > ul > li > div').removeClass("calOn"); $(this).next().addClass("calOn"); }); }); } });