jQuery(function ($) { 'use strict'; // 메뉴바 그림자 (Bootstrap 3 - affix) if ($('#mainNavbar').length && typeof $('#mainNavbar').affix === 'function') { $('#mainNavbar').affix({ offset: { top: 40 } }); } // 스크롤 애니메이션 (내부 링크 이동) $('a[href*="#"]').on("click", function (e) { var target = $(this.getAttribute('href')); if (target.length) { $('html, body').stop().animate({ scrollTop: target.offset().top - 136 }, 700); } else if (this.getAttribute('href') === '#header') { $('html, body').stop().animate({ scrollTop: 0 }, 700); } e.preventDefault(); }); // 탑 가기 버튼 표시/숨김 $(window).on('scroll', function () { if ($(this).scrollTop() > 100) { $('.scroll-up').fadeIn(); } else { $('.scroll-up').fadeOut(); } }); // 제품 슬라이드 (Owl Carousel) var pdtsCarousel = $('.pdts-carousel'); if (pdtsCarousel.length && typeof pdtsCarousel.owlCarousel === 'function') { pdtsCarousel.owlCarousel({ items: 5, margin: 20, loop: true, autoplay: true, autoplayTimeout: 2000, autoplayHoverPause: true, smartSpeed: 600, nav: false, dots: false, responsive: { 0: { items: 2 }, 600: { items: 3 }, 1000: { items: 5 } } }); pdtsCarousel.on('mouseenter', function () { $(this).trigger('stop.owl.autoplay'); }); pdtsCarousel.on('mouseleave', function () { $(this).trigger('play.owl.autoplay', [2000]); }); } // 텍스트 페이드 인 $(".mstx-inw").hide().fadeIn(1000); // 메뉴 토글 (모바일 메뉴 아이콘 클릭 시) $(".navbar-toggle").on("click", function () { $(this).toggleClass("active"); }); // 이미지 교체 $("img").each(function () { var currentSrc = $(this).attr("src"); if (currentSrc === "/cimg/arr_page_go.gif") { $(this).attr("src", "../img/vdata/inc/images/par1.png"); } else if (currentSrc === "/cimg/arr_page_next.gif") { $(this).attr("src", "../img/vdata/inc/images/par2.png"); } else if (currentSrc === "/cimg/arr_page_back.gif") { $(this).attr("src", "../img/vdata/inc/images/pal1.png"); } else if (currentSrc === "/cimg/arr_page_pre.gif") { $(this).attr("src", "../img/vdata/inc/images/pal2.png"); } }); // AOS 초기화 (애니메이션 라이브러리) if (typeof AOS !== 'undefined') { AOS.init({ duration: 800, delay: 15 }); } });