function leftMenu() { // 첫 화면에 하위메뉴 닫기 $('.depth01_li').removeClass('active'); $(".depth02_ul").slideUp(0); setTimeout(function(){ $(".depth01_li").each(function(idx,itm){ if($(itm).is(".active") == true){ $(itm).find(".depth02_ul").slideDown(0) }else{ $(itm).find(".depth02_ul").slideUp(0) } }) }) $(".menu_title").each(function(idx,itm){ var menuTitle = $(itm).text().trim(); if(menuTitle == "Dashboard"){ $(itm).addClass("none"); $(itm).attr("onclick","location.href='/cmm/main/mainPage.do'"); } }) $('.menu_title').on('click',function () { // 대시보드 메뉴는 하위메뉴가 없을 수도 있으니 클릭 이벤트 막음 if ($(this).closest(".depth01_li").index() !== 0) { $(this).closest('.depth01_li').siblings('.depth01_li').removeClass('active'); $(this).closest('.depth01_li').siblings('.depth01_li').find('.depth02_ul').slideUp(400); if($(this).closest(".depth01_li").is(".active")){ $(this).closest('.depth01_li').removeClass('active'); $(this).next('.depth02_ul').removeClass('active'); $(this).next('.depth02_ul').slideUp(400); }else{ $(this).closest('.depth01_li').addClass('active'); $(this).next('.depth02_ul').addClass('active'); $(this).next('.depth02_ul').stop().slideDown(400); } } }); }