jQuery(function($){ /* *********************** top버튼 ************************ */ $(".to-top-btn").each(function () { // top버튼 나오게 (필요한 경우에만 넣으세요) if ( $(this).length > 0 ) { $(window).scroll(function () { if ( $(window).scrollTop() > 0 ) { $(".to-top-btn").addClass("fixed"); }else { $(".to-top-btn").removeClass("fixed"); } }); } // top버튼 클릭 $(this).on("click",function () { $("html, body").animate({scrollTop:0},600,"easeInOutExpo"); // easing 효과 사용하기위해서는 jquery.easing.1.3.js이 필요함, 없을 시 기본 "swing" return false; }); }); /* *********************** 상단 검색 toggle ************************ */ $(".header-search-box").each(function () { var $searchBox = $(this); var $openBtn = $(this).find(".header-search-open-btn"); var $closeBtn = $(this).find(".header-search-close-btn"); $openBtn.click(function () { $searchBox.addClass("open"); }); $closeBtn.click(function () { $searchBox.removeClass("open"); }); }); /* *********************** 패밀리사이트 ************************ */ $(".family-site-box").each(function () { var $familyBox = $(this); var $familyListOpenBtn = $(this).children(".family-site-open-btn"); var $familyList = $(this).children(".family-site-list"); $familyListOpenBtn.click(function () { $familyList.slideToggle(500); $familyBox.toggleClass("open"); return false; }); $(this).mouseleave(function () { $familyList.slideUp(500); $familyBox.removeClass("open"); }); }); /* *********************** 탭 공통 ************************ */ $(".cm-tab-container").each(function () { var $cmTabList = $(this).children(".cm-tab-list"); var $cmTabListli = $cmTabList.find("li"); var $cmConWrapper = $(this).children(".cm-tab-content-wrapper"); var $cmContent = $cmConWrapper.children(".cm-tab-con"); // 탭 영역 숨기고 selected 클래스가 있는 영역만 보이게 var $selectCon = $cmTabList.find("li.selected").find("a").attr("href"); $cmContent.hide(); $($selectCon).show(); $cmTabListli.children("a").click(function () { if ( !$(this).parent().hasClass("selected")) { var visibleCon = $(this).attr("href"); $cmTabListli.removeClass("selected"); $(this).parent("li").addClass("selected"); $cmContent.hide(); $(visibleCon).fadeIn(); } return false; }); }); }); jQuery(document).ready(function($){ var current_path =window.location.pathname; console.log(current_path); $('.submenu ul li a[href="'+current_path+'"]').addClass('active'); var search = window.location.search; $('.sul_menu div a[href="'+current_path+search+'"]').parent().addClass('on'); }); jQuery(document).ready(function($){ var current_path =window.location.pathname; console.log(current_path); $('.sul_menu ul li a[href="'+current_path+'"]').addClass('active'); var code = getParameter('com_board_category_code') if (code) { code = code.split("c")[1] $('.sul_menu a').eq(code).addClass("active_menu") } else { $('.sul_menu a').eq(0).addClass("active_menu") } function getParameter(name) { var half = location.search.split(name + '=')[1]; return half !== undefined ? decodeURIComponent(half.split('&')[0]) : null; } });