- 删除 7 个死模板文件 (products/services/quality/process/projects/customization/rfq) - 删除 13 个旧图片素材 (jpg/png/webp) - 新增 CDN SRI 完整性校验 (Bootstrap CSS/JS) - 新增面包屑导航模板组件 - 新增代码清理方案与代码审查标准文档 - 更新 README.md
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
(function ($) {
|
|
'use strict';
|
|
|
|
document.documentElement.classList.remove('no-js');
|
|
document.documentElement.classList.add('js');
|
|
|
|
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 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();
|
|
initVideoLightbox();
|
|
initNavigation();
|
|
});
|
|
})(jQuery);
|