window.addEventListener('load', function(){ // 사업 소개 이벤트 let businessLinks = document.querySelectorAll('.snb-menu-anchor a'); // 사업소개 클릭 이벤트 businessLinks.forEach((link) => { link.addEventListener('click', function(e){ // 기본 이벤트 제거 e.preventDefault(); let targetId = this.getAttribute('href'); let targetSec = document.querySelector(targetId); if(lenis){ lenis.scrollTo(targetSec, { offset: 0, duration:2, easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), }); } else { targetSec.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }) }) const params = new URLSearchParams(window.location.search); const targetId = params.get('pageId'); if (targetId) { const el = document.getElementById(targetId); if (el) { // 약간 딜레이 주면 레이아웃 안정화 이후에 스크롤됨 setTimeout(() => { el.scrollIntoView({ behavior: 'smooth' }); }, 100); } } }, false);