Files
car-t-t/assets/js/theme.js
T
zhs123 8a2890f8b4 refactor: 多页面门店重构 — CPT + 页面模板 + README 更新
- CPT: service(服务项目) + case(案例作品集) + case_type 分类
- 页面: 关于门店/常见问题/预约联系 + archive/single 模板
- 首页精简为 hero+trust+service-teaser+case-teaser+cta
- 主题激活自动迁移 Customizer 产品数据为 service 文章
- 预约表单: nonce+honeypot+rate-limit, URL 参数预填服务
- 联系页: 门店地址/电话/营业时间/百度地图导航
- Customizer 面板改为门店语境(13 板块)
- header CTA 改为预约, helpers 更新为门店口径
- README.md 全面更新为门店多页面架构文档
2026-07-24 15:37:40 +08:00

47 lines
1.5 KiB
JavaScript

(function ($) {
'use strict';
document.documentElement.classList.remove('no-js');
document.documentElement.classList.add('js');
var reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
function initStickyHeader() {
var header = document.querySelector('#header');
if (!header) return;
function updateHeader() {
header.classList.toggle('sticky', window.scrollY > 1);
}
updateHeader();
window.addEventListener('scroll', updateHeader, { passive: true });
}
function initAnimations() {
if (!window.AOS || typeof window.AOS.init !== 'function') return;
window.AOS.init({ duration: reducedMotion ? 0 : 700, once: true, disable: reducedMotion });
}
function initVideoLightbox() {
if (!$.fn || typeof $.fn.colorbox !== 'function') return;
$('.youtube').colorbox({ iframe: true, innerWidth: 960, innerHeight: 585, maxWidth: '95%', maxHeight: '90%' });
}
function initNavigation() {
var panel = document.querySelector('#fragrance-navigation');
if (!panel || !window.bootstrap || !window.bootstrap.Offcanvas) return;
panel.querySelectorAll('a[href*="#"]').forEach(function (link) {
link.addEventListener('click', function () {
var instance = window.bootstrap.Offcanvas.getInstance(panel);
if (instance) instance.hide();
});
});
}
$(function () {
initStickyHeader();
initAnimations();
initVideoLightbox();
initNavigation();
});
})(jQuery);