$(function(){ $('#backtop').click(function () { $('body,html').animate({ scrollTop: 0 }, 500); return false; }); $(".topnav").click(function () { $(this).parent().find(".subnav").fadeIn('normal').show(); $(this).parent().hover(function () { }, function () { $(this).parent().find(".subnav").fadeOut('normal'); }); }); $(".closed").click(function () { $(".subnav").fadeOut('normal'); }); // 스크롤시 헤더 변화 $(window).scroll(function () { const scroll_top = $(this).scrollTop(); if (scroll_top >= 50) { $("#header").addClass("white"); $(".header").addClass("on"); } else { $("#header").removeClass("white"); $(".header").removeClass("on"); } }); }); $(document).ready(function () { // 탭메뉴 var sub_menu = $(".tab_menu li, .tab_nav li"), tab_menu = $(".tab_nav li"), tab_content = $("#tab_box > div"), currentUrl = location.href; sub_menu.each(function(){ var targetSrt = $(this).find("a").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()); // $("#site_map").css("display","none"); // $("#m_menu").removeClass("on"); // $("html, body").css("overflow","auto"); }); function activateTab(idx) { tab_menu.find("a").removeClass("active"); tab_menu.eq(idx).find("a").addClass("active"); tab_content.hide(); tab_content.eq(idx).show(); } // 이벤트 페이지 링크 var tab_menu = $(".tab_link li"), tab_content = $("#tab_box > div"), currentUrl = location.href; tab_menu.click(function(e){ e.preventDefault(); activateTab($(this).index()); }); function activateTab(idx) { tab_menu.find("a").removeClass("on"); tab_menu.eq(idx).find("a").addClass("on"); 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) { $("#header ul li.hn" + page.hn + " h3").addClass("on"); //1depth 활성 } if(page.hn >= 11) { $("#header ul li.hn" + page.hn + " h3").addClass("on"); //유틸 1depth 활성 } $(".snb ul li.sn" + page.sn).find(" a").addClass("on").end().find("> ul").addClass("on").find("> li.cn" + page.cn + " a").addClass("on"); //2depth 활성 }