$(document).ready(function () { // gsap 스크롤 gsap.registerPlugin(ScrollTrigger, ScrollSmoother); let smoother = ScrollSmoother.create({ wrapper: '#smooth-wrapper', content: '#smooth-content', smooth: 1.5, effects: true, smoothTouch: 0.1, }); // ********** header 메뉴 ********** $('nav > ul > li').hover( function () { $(this).children('.subnav').stop(true).slideDown(400); }, function () { $(this).children('.subnav').stop(true).slideUp(300); } ); // ********** header 스크롤 효과 ********** var path = window.location.pathname; var page = path.split('/').pop(); var isMainPage = page === '' || page === 'index.html' || page === 'index.php'; // 서브페이지는 body에 subpage 클래스 추가 if (!isMainPage) { $("body").addClass("subpage"); } $(window).scroll(function () { const scroll_top = $(this).scrollTop(); if (scroll_top >= 30) { $("header").addClass("on"); } else { $("header").removeClass("on"); } }); // ********** section5 둘러보기 ********** var Swiper1 = new Swiper('.mainindex .mySwiper1', { loop: true, speed: 900, observer: true, loopedSlides: 10, slidesPerView: 1, spaceBetween: 20, autoplay: { delay: 2500, disableOnInteraction: false }, navigation: { nextEl: "#section5 .swiper-button-next", prevEl: "#section5 .swiper-button-prev", }, // pagination: { // el: "#section3 .swiper-pagination", // clickable: true, // }, }); // ********** sub10102 둘러보기 ********** var Swiper3 = new Swiper('.sub10102 .mySwiper1', { loop: true, speed: 900, observer: true, loopedSlides: 10, slidesPerView: 1, spaceBetween: 20, autoplay: { delay: 2500, disableOnInteraction: false }, navigation: { nextEl: ".sub10102 .swiper-button-next", prevEl: ".sub10102 .swiper-button-prev", }, // pagination: { // el: "#section3 .swiper-pagination", // clickable: true, // }, }); // ********** sub30101 s1 ********** var Swiper2 = new Swiper('.sub30101 .mySwiper2', { loop: true, speed: 1000, observer: true, loopedSlides: 10, slidesPerView: 1, spaceBetween: 0, autoplay: { delay: 4000, disableOnInteraction: false }, // navigation: { // nextEl: "#section5 .swiper-button-next", // prevEl: "#section5 .swiper-button-prev", // }, pagination: { el: ".sub30101 .swiper-pagination", clickable: true, }, }); // **************************************** // ********** subpage 서브메뉴 ********** $('.subtop .depth').hide(); $('.submenuBtn').click(function (e) { // a 태그 클릭은 그냥 진행 if ($(e.target).closest('a').length) return; e.stopPropagation(); const $current = $(this).children('.depth'); const currentClass = $current.attr('class'); $('.submenuBtn').not(this).children('.depth') .filter(function () { return $(this).attr('class') === currentClass; }) .stop().slideUp(350); $current.stop().slideToggle(350); }); // 현재 위치 표시 const fileName = window.location.pathname.split('/').pop(); const match = fileName.match(/sub(\d+)_(\d+)_(\d+)\.(html|php)$/); if (match) { const [, d1, d2, d3] = match; // depth2: 같은 d1_d2 카테고리면 active $('.depth2 a').each(function () { const hrefMatch = $(this).attr('href').match(/sub(\d+)_(\d+)_(\d+)\.(html|php)$/); if (hrefMatch && hrefMatch[1] === d1 && hrefMatch[2] === d2) { $(this).parent().addClass('active'); } }); // depth3: 정확히 d1_d2_d3 모두 일치할 때만 active $('.depth3 a').each(function () { const hrefMatch = $(this).attr('href').match(/sub(\d+)_(\d+)_(\d+)\.(html|php)$/); if (hrefMatch && hrefMatch[1] === d1 && hrefMatch[2] === d2 && hrefMatch[3] === d3) { $(this).parent().addClass('active'); } }); } }); // **************************************** 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 활성 }