- 全部子页面(about/advantages/applications/products/resources/services/customer-service)顶部大图统一改为深色岩层纹理,并加入跟随鼠标的粒子网络 - 全部子页面引入 Lenis + GSAP/ScrollTrigger,与首页动效体系保持一致 - 顶部导航改为默认透明、滚动后转为深色玻璃底色,不再是纯白底色条 - 底部导航:整体改为更深邃的岩层蓝,页面内容到底部之间新增渐变过渡(footer-fade) - 底部导航合作伙伴模块精简为单一跳转入口,实际内容迁移至【关于我们】新增的合作伙伴子页(about.html#partners),并同步到顶部导航与侧边快速导航 - 联系方式精简为单一电话 16689661917,去除所有联系人姓名 - 首页去除轮播,只保留品牌主视觉一屏;标题改为「HYPER-GENE · 生命孪生体系——生命从此被计算」的错落艺术排版,保留极低成本/高效/灵活/高通量徽标 - 岩石纹理升级:新增分层分形噪声 + 斜向岩层条带,观感更接近真实岩石 - 粒子效果增大:画布铺满整个hero/page-hero区域,粒子半径与连线距离均增加
105 lines
3.9 KiB
JavaScript
105 lines
3.9 KiB
JavaScript
// 导航栏功能
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
// Logo 点击返回首页
|
||
const logoSection = document.querySelector('.logo-section');
|
||
if (logoSection) {
|
||
logoSection.addEventListener('click', () => {
|
||
window.location.href = 'index.html';
|
||
});
|
||
}
|
||
|
||
// 响应式导航菜单(如果需要移动版本)
|
||
const navMenu = document.querySelector('.nav-menu');
|
||
if (navMenu) {
|
||
// 点击菜单项后关闭下拉菜单(如果有特殊需求)
|
||
const navLinks = document.querySelectorAll('.nav-link');
|
||
navLinks.forEach(link => {
|
||
link.addEventListener('click', (e) => {
|
||
// 保留默认行为,允许正常跳转
|
||
});
|
||
});
|
||
}
|
||
|
||
// 响应式设计支持
|
||
if (window.innerWidth <= 768) {
|
||
adjustMobileNav();
|
||
}
|
||
|
||
window.addEventListener('resize', () => {
|
||
if (window.innerWidth <= 768) {
|
||
adjustMobileNav();
|
||
}
|
||
});
|
||
|
||
const path = window.location.pathname;
|
||
document.querySelectorAll('.nav-menu > li > .nav-link').forEach(link => {
|
||
const href = link.getAttribute('href') || '';
|
||
const isHome = (href === '#home' || href.endsWith('index.html')) && !path.includes('/pages/');
|
||
const isCurrent =
|
||
isHome ||
|
||
(href.includes('products') && path.includes('products')) ||
|
||
(href.includes('services') && path.includes('services')) ||
|
||
(href.includes('applications') && path.includes('applications')) ||
|
||
(href.includes('advantages') && path.includes('advantages')) ||
|
||
(href.includes('resources') && path.includes('resources')) ||
|
||
(href.includes('about') && path.includes('about'));
|
||
if (isCurrent) link.classList.add('active');
|
||
});
|
||
|
||
// 顶部导航:滚动后切换为深色玻璃底色,保证在浅色内容区域上依然清晰可读
|
||
const navbarEl = document.querySelector('.navbar');
|
||
if (navbarEl) {
|
||
const toggleNavbarState = () => {
|
||
if (window.scrollY > 40) {
|
||
navbarEl.classList.add('is-scrolled');
|
||
} else {
|
||
navbarEl.classList.remove('is-scrolled');
|
||
}
|
||
};
|
||
toggleNavbarState();
|
||
window.addEventListener('scroll', toggleNavbarState, { passive: true });
|
||
}
|
||
});
|
||
|
||
function adjustMobileNav() {
|
||
const navMenu = document.querySelector('.nav-menu');
|
||
if (navMenu) {
|
||
// 移动设备上的调整
|
||
// 可以根据需要添加汉堡菜单等功能
|
||
}
|
||
}
|
||
|
||
// 平滑滚动
|
||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||
anchor.addEventListener('click', function (e) {
|
||
e.preventDefault();
|
||
const target = document.querySelector(this.getAttribute('href'));
|
||
if (target) {
|
||
target.scrollIntoView({
|
||
behavior: 'smooth',
|
||
block: 'start'
|
||
});
|
||
}
|
||
});
|
||
});
|
||
|
||
function initImageLightbox() {
|
||
if (document.querySelector('.image-lightbox')) return;
|
||
const box = document.createElement('div');
|
||
box.className = 'image-lightbox';
|
||
box.innerHTML = '<button type="button" aria-label="关闭">×</button><img alt="图片预览">';
|
||
document.body.appendChild(box);
|
||
const img = box.querySelector('img');
|
||
const close = () => box.classList.remove('open');
|
||
box.querySelector('button').addEventListener('click', close);
|
||
box.addEventListener('click', event => { if (event.target === box) close(); });
|
||
document.addEventListener('keydown', event => { if (event.key === 'Escape') close(); });
|
||
document.querySelectorAll('.product-content img, .resource-content img, .about-container img, .products-preview img').forEach(item => {
|
||
item.addEventListener('click', () => {
|
||
img.src = item.currentSrc || item.src;
|
||
img.alt = item.alt || '图片预览';
|
||
box.classList.add('open');
|
||
});
|
||
});
|
||
}
|