(async () => { const { EventManager, utils } = ShopbySkin; ShopbySkin.EventManager.on('PAGE_LOAD_COMPLETED', (commonData) => { profile = commonData.profile; }); // [Jay] 회원등급 스와이퍼 const memberGradeSwiperOptions = { id: 'member-grade-slide', direction: 'horizontal', effect: 'slide', slidesPerView: 1, spaceBetween: 16, autoHeight: true, navigation: { nextEl: '.member-grade-next', prevEl: '.member-grade-prev', }, pagination: { el: '.swiper-pagination', clickable: false, type: 'progressbar', }, on: { slideChange: function () { const activeSlide = this.slides[this.activeIndex]; // 현재 활성 슬라이드 const slideTop = activeSlide.getBoundingClientRect().top + window.scrollY - 50; // 슬라이드의 시작점 계산 // 브라우저를 슬라이드 시작점으로 스크롤 window.scrollTo({ top: slideTop, behavior: 'smooth', // 부드럽게 이동 }); }, }, }; utils.initSwiper(memberGradeSwiperOptions); // END const ACTION_HANDLER_MAP = {}; const clickEventListener = (e) => { if (!e?.target) { return; } const btn = e?.target?.closest?.('[shopby-action]') || e?.target?.parentElement?.closest?.('[shopby-action]'); const action = btn?.getAttribute('shopby-action'); if (!btn) { return; } ACTION_HANDLER_MAP[action]?.({ event: e, }); }; document.addEventListener('click', clickEventListener); })();