ÿØÿà JFIF ` ` ÿþ
Server : Apache System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : tkt_travelbus ( 1137) PHP Version : 7.0.0p1 Disable Function : mysql_pconnect Directory : /tkt_travelbus/www/js/ |
Upload File : |
// prd navbox $(function () { let didScroll; let lastScrollTop = 0; let delta = 0; // 이벤트를 발생시킬 스크롤의 이동 범위 let navTop = $('#prd_navbox').offset().top; hasScrolled(); linkActive(); $(window).scroll(function (event) { didScroll = true; }); setInterval(function () { if (didScroll) { hasScrolled(); linkActive(); didScroll = false; } }, 0); function hasScrolled() { let st = $(this).scrollTop(); // delta로 설정한 값보다 많이 스크롤 되어야 실행된다. if (Math.abs(lastScrollTop - st) <= delta) return; if (st > navTop) { $("#prd_navbox").addClass("sticky") $(".prd_navlink.link1").removeClass("on") $("#prd_tab_contents").addClass("sticky") $(".wrap .side_wrap").addClass("sticky") } if (st < navTop) { $("#prd_navbox").removeClass("sticky") $(".prd_navlink.link1").addClass("on") $("#prd_tab_contents").removeClass("sticky") $(".wrap .side_wrap").removeClass("sticky") } lastScrollTop = st; // 현재 멈춘 위치를 기준점으로 재설정 } function linkActive() { let sectionIds = $('.prd_navlink'); sectionIds.each(function () { let navHeight = $("#prd_navbox").outerHeight(); let container = $(this).attr('data-target'); let containerOffset = $(container).offset().top; let containerHeight = $(container).outerHeight(); let containerBottom = containerOffset + containerHeight; let scrollPosition = $(document).scrollTop(); if (scrollPosition < containerBottom - navHeight - 46 && scrollPosition >= containerOffset - navHeight - 46) { $(this).addClass('active'); } else { $(this).removeClass('active'); } }); } }) $(document).ready(function () { // prd navlink move $('.prd_navlink').click(function () { event.preventDefault(); let container = $(this).attr('data-target'); let navHeight = $("#prd_navbox").outerHeight(); let containerOffset = $(container).offset().top - navHeight; window.scrollTo(0, containerOffset); }); // detail_more $('#detail_more').click(function () { $("#detail_img").addClass("show") $("#detail_more").addClass("hide") $("#detail_hide").removeClass("hide") }); // detail_hide $('#detail_hide').click(function () { $("#detail_img").removeClass("show") $("#detail_more").removeClass("hide") $("#detail_hide").addClass("hide") }); });