$(document).ready(function () { function initMenu() { // 기존 이벤트 제거 $(".m_btns").off("mouseenter click"); $(".close_btn").off("click"); $(document).off("click"); if ($(window).width() > 1200) { // 1200 이상 $(".m_btns").mouseenter(function () { $("#menu").addClass("on"); }); $(".close_btn").click(function () { $("#menu").removeClass("on"); }); $(document).click(function (e) { if (!$(e.target).closest(".nav, .m_btns").length) { $("#menu").removeClass("on"); } }); } else { // 1200 이하 $(".m_btns").click(function () { $("#menu").addClass("on"); }); $(".close_btn").click(function () { $("#menu").removeClass("on"); }); } } // 초기 실행 initMenu(); // 리사이즈시 재실행 $(window).resize(function () { initMenu(); }); // ------------------------------------------- // 푸터 top 버튼 $('#back-top').click(function () { $('body,html').animate({ scrollTop: 0 }, 1000); return false; }); // 서브 snb $(".topnav").click(function () { $(this).parent().find(".snbnav").fadeIn('normal').show(); $(this).parent().hover(function () { }, function () { $(this).parent().find(".snbnav").fadeOut('normal'); }); }); // sub6_6 $('.faq .q_box').click(function () { $(this).toggleClass('active').next('.sub_nav').slideToggle(); $(this).parent("li").toggleClass('active'); if ($(this).hasClass('active')) { $(this).find('.xi-plus-min').removeClass().addClass('xi-minus-min'); } else { $(this).find('.xi-minus-min').removeClass().addClass('xi-plus-min'); } }); // 서브탭메뉴 // var tabLink = $(".tab_nav li"), // subLink = $(".tab_menu li"), // currentUrl = location.href, // tabContent = $("#tab_box > div"); // tabLink.click(function(e){ // e.preventDefault(); // var targetIdx = $(this).index(); // activateTab(targetIdx); // }); // subLink.click(function(){ // var targetIdx = $(this).index(); // console.log(targetIdx); // activateTab(targetIdx); // $("#site_map").css("display", "none"); // }); // subLink.each(function(i){ // var conpareUrl = $(this).find("a").attr('href'); // var active = currentUrl.indexOf(conpareUrl) // var blank = currentUrl.indexOf('#'); // if(active > -1) { // activateTab(i); // } // if (blank == -1) { // activateTab(0); // } // }); // function activateTab(idx) { // tabContent.hide(); // tabLink.removeClass("active"); // tabLink.eq(idx).addClass("active"); // tabContent.eq(idx).show(); // } // var sub_menu = $(".more_btn"), // tab_menu = $(".tabs li"), // tab_content = $(".tab_cont > .tab_content"), // currentUrl = location.href; // sub_menu.each(function () { // var targetSrt = $(this).attr("href"); // if (currentUrl.indexOf(targetSrt) > -1) { // var targetIdx = $(this).index(); // activateTab(targetIdx); // } // if (currentUrl.indexOf("#") == -1) { // activateTab(0); // } // }); // tab_menu.click(function (e) { // e.preventDefault(); // activateTab($(this).index()); // }); // sub_menu.click(function () { // activateTab($(this).index()); // }); // function activateTab(idx) { // tab_menu.removeClass("active"); // tab_menu.eq(idx).addClass("active"); // tab_content.hide(); // tab_content.eq(idx).show(); // } }); function setPage(arg) { //navigation hn:1depth, sn:2depth, cn:3depth 瑜� 諛쏆쓬 page = jQuery.extend({ hn: "", sn: "", cn: "" }, arg || {}); if (window.console) { console.log("hn : " + page.hn + "\nsn : " + page.sn + "\ncn : " + page.cn); } if (page.hn != 10) { $(".hn" + page.hn + " a").addClass("on"); //1depth �쒖꽦 } if (page.hn >= 11) { $(".hn" + page.hn + " a").addClass("on"); //�좏떥 1depth �쒖꽦 } $(".hn" + page.hn + "> .subnav li.sn" + page.sn).addClass("on").end().find("> ul").addClass("on").find("> li.cn" + page.cn + " a").addClass("on"); //2depth �쒖꽦 $(".snb .snb_pc li.sn" + page.sn).addClass("on").end().find("> ul").addClass("on").find("> li.cn" + page.cn + " a").addClass("on"); //2depth �쒖꽦 }