/*! 2024. 5. 2. 오후 4:59:11 */ (() => { // webpackBootstrap var __webpack_exports__ = {}; (() => { // 공통 하단에 필요한 스크립트를 추가하세요. })(); // 관련사이트 // document.getElementById('btnSiteLink').addEventListener('click', function () { // // this.classList.toggle('active'); // document.querySelector('.site_link').classList.toggle('active'); // }); // btnSiteLink 버튼 클릭 시 .site_link에 active 클래스를 토글 document.getElementById('btnSiteLink').addEventListener('click', function() { document.querySelector('.site_link').classList.toggle('active'); }); // 모든 .site_link 내 a 요소에 클릭 이벤트 추가 const siteLinkBtns = document.querySelectorAll('.site_link li a'); siteLinkBtns.forEach(btn => { btn.addEventListener('click', function(event) { const siteLink = document.querySelector('.site_link'); // 클릭 시 active 클래스 제거 if (siteLink.classList.contains('active')) { siteLink.classList.remove('active'); } }); }); // 오른쪽 fixed // 스크롤과 페이지 로드 시 실행될 함수를 정의 function adjustSideBtnsPosition() { var windowHeight = window.innerHeight; // 창의 높이 var scrollPosition = window.scrollY || window.pageYOffset; // 현재 스크롤 위치 var sideBtnsOriginalBottom = 60; // .quick-menu__container 원래 bottom 위치 var bottomLimit = 470; // 스크롤 내렸을 때 bottom 위치 var sideBtns = document.querySelector('.quick-menu__container'); var sideBtnsHeight = sideBtns.offsetHeight; // .quick-menu__container의 높이 var documentHeight = document.documentElement.scrollHeight; // 문서 전체 높이 // 스크롤 위치에 따라 .quick-menu__container의 위치를 조정 if (documentHeight - windowHeight - scrollPosition <= bottomLimit) { // 스크롤이 아래쪽에 도달했을 때 var translateY = bottomLimit - (documentHeight - windowHeight - scrollPosition) - sideBtnsOriginalBottom; sideBtns.style.transform = 'translateY(-' + translateY + 'px)'; sideBtns.style.bottom = sideBtnsOriginalBottom + 'px'; } else { // 스크롤이 아래쪽에 도달하지 않았을 때 sideBtns.style.transform = 'translateY(0)'; sideBtns.style.bottom = sideBtnsOriginalBottom + 'px'; } // 스크롤 위치가 500 이상일 때 sideBtns를 서서히 나타나게 함 if (scrollPosition > 550) { sideBtns.classList.add('on'); } else { sideBtns.classList.remove('on'); } } // 스크롤 이벤트 리스너 추가 window.addEventListener('scroll', adjustSideBtnsPosition); // 페이지 로드 시 함수 실행 document.addEventListener('DOMContentLoaded', adjustSideBtnsPosition); document.querySelector('#btnToggle').addEventListener('click', function () { document.querySelector('.quick-menu').classList.toggle('active') }) var btnGoBottom = document.getElementById("goBottom"); btnGoBottom.addEventListener("click", function () { window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' }); }); })();