$(document).ready(() => { setHeaderStyle() setCurScroll() $(document).scroll(setHeaderStyle) window.addEventListener('resize', debounce(handleResize, 500)) $('.ias-tpl-footer-content-right-item-title-container').click(function () { if (window.innerWidth <= 1200) { $(this).children('.ias-tpl-footer-content-right-item-title-button').toggleClass('ias-tpl-footer-content-right-item-content-rotate') $(this).next('.ias-tpl-footer-content-right-item-content-list-container').slideToggle('fast') } }) $('.ias-tpl-footer-media-item-container').click(function () { if (window.innerWidth <= 1200) { setTimeout(() => { $(this).children('.ias-tpl-footer-media-qrcode').css('display', 'flex') }, 0) } }) $(document).click(function () { if (window.innerWidth <= 1200) { $('.ias-tpl-footer-media-qrcode').css('display', 'none') } }) $('.ias-mobile-header-menu').click(function () { const curScrollTop = $(document).scrollTop() if ($('.ias-mobile-header-menu').hasClass('ias-mobile-header-menu-active') && curScrollTop === 0) { $('.ias-mobile-tpl-header').removeClass('ias-mobile-tpl-header-active') } else { $('.ias-mobile-tpl-header').addClass('ias-mobile-tpl-header-active') } if ($('.ias-mobile-header-menu').hasClass('ias-mobile-header-menu-active')) { $('body').removeClass('ias-tpl-overflow-hidden') } else { $('body').addClass('ias-tpl-overflow-hidden') } $('.ias-mobile-header-menu').toggleClass('ias-mobile-header-menu-active') $('.ias-mobile-tpl-header-nav-list').toggleClass('ias-mobile-tpl-header-nav-list-active') //20250902 $('.ias-mobile-tpl-header').toggleClass('ias-mobile-tpl-header-on') }) }) function setHeaderStyle() { const curScrollTop = $(document).scrollTop() if (curScrollTop === 0) { $('.ias-tpl-header').removeClass('ias-tpl-header-hover') $('.ias-tpl-header').addClass('ias-tpl-header-default') $('.ias-mobile-tpl-header').removeClass('ias-mobile-tpl-header-active') } else { $('.ias-tpl-header').removeClass('ias-tpl-header-default') $('.ias-tpl-header').addClass('ias-tpl-header-hover') $('.ias-mobile-tpl-header').addClass('ias-mobile-tpl-header-active') } } function setCurScroll() { let lastScrollTop = 0; window.addEventListener("scroll", function () { const navbar = document.querySelector(".ias-tpl-header"); const mobileNavbar = document.querySelector(".ias-mobile-tpl-header"); const filterNav = document.querySelector(".cars-filternav-con"); const currentScroll =window.pageXOffset || document.documentElement.scrollTop; if (!filterNav) { if (currentScroll > lastScrollTop) { navbar.style.top = "-60px"; mobileNavbar.style.top = "-60px"; } else { navbar.style.top = "0"; mobileNavbar.style.top = "0"; } lastScrollTop = currentScroll <= 0 ? 0 : currentScroll; } else { navbar.style.top = "0"; mobileNavbar.style.top = "0"; lastScrollTop = currentScroll <= 0 ? 0 : currentScroll; } }); } function handleResize() { if (window.innerWidth > 1200) { $('body').removeClass('ias-tpl-overflow-hidden') } else { if ($('.ias-mobile-header-menu').hasClass('ias-mobile-header-menu-active')) { $('body').addClass('ias-tpl-overflow-hidden') $('.ias-mobile-tpl-header').addClass('ias-mobile-tpl-header-active') } } } function debounce(fn, t) { let timer return function () { const ctx = this const args = arguments clearTimeout(timer) timer = setTimeout(function () { fn.apply(ctx, args) }, t) } }