// 스크롤 시 헤더 최상단 숨김 let isScroll = false; let lastScrollTop = 0, delta = 1; $(window).scroll(function () { if ($(this).scrollTop() < 80) { return; } let nowScrollTop = $(this).scrollTop(); if (Math.abs(lastScrollTop - nowScrollTop) >= delta) { if (nowScrollTop > lastScrollTop) { isScroll = true; } else { isScroll = false; } } lastScrollTop = nowScrollTop; }); setInterval(function () { if ($(".header").hasClass("header--sub")) { return; } if (isScroll) { $(".header").addClass("scroll"); } else { $(".header").removeClass("scroll"); } }, 200); // 상단 이동 스크롤 버튼 let scrollToTop = $(".quick-menu__to-top > button"); let isButtonVisible = false; scrollToTop.hide(); scrollToTop.click(function () { $("html, body").stop().animate({ scrollTop: 0 }, 500); }); function checkScroll() { let scrollTop = $(window).scrollTop(); if (scrollTop > 100) { if (!isButtonVisible) { scrollToTop.fadeIn(); isButtonVisible = true; } } else { if (isButtonVisible) { scrollToTop.fadeOut(); isButtonVisible = false; } } } function scrollIntervalFunction() { checkScroll(); window.requestAnimationFrame(scrollIntervalFunction); } window.requestAnimationFrame(scrollIntervalFunction); //푸터 사업자 정보 토글 $(".footerHide").hide(); $(".footer__second__detailBtn").click(function () { $(".footerHide").toggle(); }); // 푸터 패밀리 사이트 링크 $(".family-site-link").niceSelect(); $(".family-site-link").on("change", function () { var url = $(this).val(); if (url) { window.open(url, "_blank"); $(this).closest("div").find(".nice-select li").removeClass("selected"); $(this).closest("div").find(".nice-select .current").text("FAMILY SITE"); } return false; }); // 커스텀 셀렉트박스 if ($(".select-box > select").length > 0) { $(".select-box > select").niceSelect(); } // 인풋 텍스트 숫자만 입력 (콤마 X, 휴대폰번호 등) $(".input-text.number").on("input", function () { this.value = this.value.replace(/[^0-9]/g, ""); }); // 인풋 텍스트 숫자만 입력 (콤마 O, 금액 등) $(".input-text.numberComma").on("input", function () { var input = $(this).val(); $(this).val(input.replace(/[^0-9]/g, "").replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")); }); //해당 클래스를 가진 요소 3자리 마다 콤마 $(".comma").each(function () { var text = $(this).text(); $(this).text(text.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, "$1,")); }); // 데이트 피커 // $(".datepicker").each(function () { $(this).datepicker({ dateFormat: "yy-mm-dd", prevText: "이전 달", nextText: "다음 달", changeMonth: "true", changeYear: "true", dayNames: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"], dayNamesMin: ["일", "월", "화", "수", "목", "금", "토"], monthNames: [ "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월", ], monthNamesShort: [ "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월", ], showMonthAfterYear: true, yearSuffix: "년", firstDay: 0, maxDate: 0, // 오늘로부터 1년 전까지의 날짜까지 선택 가능 // beforeShowDay: function (date) { // // 오늘로부터 1년 전까지의 날짜를 비활성화 // let currentDate = new Date(); // currentDate.setDate(currentDate.getDate() - 366); // return [date.getTime() > currentDate.getTime() - 1, ""]; // }, }); }); // 기간 선택 탭버튼 var dateRangeBtn = $(".dateRange-btn"); dateRangeBtn.click(function (e) { if (e.detail === 0) { return; } e.preventDefault(); var otherBtn = $(this).siblings(); otherBtn.removeClass("selected"); $(this).addClass("selected"); }); // 체크박스 주변 박스 클릭 시, 체크박스 체크/해제 $(".product-option__item").click(function (e) { e.stopPropagation(); $(this) .find("input[type=checkbox]") .prop("checked", !$(this).find("input[type=checkbox]").prop("checked")); }); // 2401016 햄버거 메뉴 수정 $('.menu_navigation_wrap .depth').click(function (e) { e.preventDefault(); if ($(this).parent().hasClass('on')) { $(this).parent().next().slideUp(); $(this).parent().removeClass('on'); return false; } $('.menu_navigation_wrap .depth').parent().removeClass('on'); $('.menu_navigation_wrap .view').slideUp(); $('.menu_navigation_wrap .view .subview').slideUp(); $('.menu_navigation_wrap .view .on').removeClass('on'); $(this).parent().next().slideToggle(); $(this).parent().toggleClass('on'); return false; }); $('.menu_navigation_wrap .sublist .hasSub').click(function (e) { if ($(this).parent().hasClass('on')) { $(this).parent().next().slideUp(); $(this).parent().removeClass('on'); return false; } e.preventDefault(); $('.menu_navigation_wrap .sublist .hasSub').parent().removeClass('on'); $('.menu_navigation_wrap .sublist .subview').slideUp(); $(this).parent().next().slideToggle(); $(this).parent().toggleClass('on'); return false; }); const recentSideSwiper = new Swiper('.recentlySide-swiper', { slidesPerView: 3, slidesPerGroup: 3, spaceBetween: 20, loop: true, pagination: { el: '.recentlySide-swiper .swiper-pagination', clickable: true, }, });