$(document).ready(function () { $(window).resize(function(){ //console.log(window.outerWidth); }); //상단 마우스 $(".gnb-menu > li").on('mouseenter' ,function(){ $(this).children(".submenu").show(); $(this).children('a').addClass('current'); }).on('mouseleave' ,function(){ $(this).children(".submenu").stop().hide(); $(this).children('a').removeClass('current'); }); //상단 tab키 $(".gnb-menu > li > a").on('focusin' ,function(){ $(".submenu").hide(); $(this).parent().children(".submenu").show(); $(".gnb-menu-item").removeClass('current'); $(this).parent().children('a').addClass('current'); }); //상단 공통 $("div.depth3").on('mouseenter focusin' ,function(){ $(this).siblings(".depth2").addClass('active'); }).on('mouseleave focusout' ,function(){ $(this).siblings(".depth2").removeClass('active'); }); //left 메뉴 클릭 이벤트 $('.dep2').on('click focusin' ,function(e){ //console.log($(this).next('.dep3').length); if($(this).attr("href") == "") e.preventDefault();//2번째 메뉴가 링크가 아닐 경우에만 사용 if($(this).next('.dep3').hasClass("on")) return false; //현재 뎁스가 열려있으면 이벤트 막음 $('.dep3').slideUp(); $('.dep2, .dep3').removeClass('on'); $(this).next('.dep3').slideDown(); $(this).next('.dep3').addClass('on'); $(this).addClass('on'); }); /*left 초기 진입 첫메뉴 세팅*/ if($('.dep2').hasClass("on")){ $(".dep2.on").click(); }else{ $(".leftMenu> ul> li:eq(0)>.dep2").click(); //선택된 메뉴가 없을 경우 최상위 뎁스 열림 - 사용되지는 않을거 같음 } //컨텐츠 탭 관리 $("ul.sub_tab li:first").addClass("on").show(); $(".sub_tab_cont").hide(); $(".sub_tab_cont:first").show(); $(".sub_tab li").click(function(e) { $(".sub_tab li").removeClass("on"); $(this).addClass("on"); var index = $(".sub_tab li").index(this); $(".sub_tab_cont").hide(); $("#sub_tab_cont" + (index + 1)).show() $("#sub_tab_cont" + (index + 1)+" .sub_tab").find("li").eq(0).trigger("click"); return false; }); });