This commit is contained in:
1247
css/index.css
1247
css/index.css
File diff suppressed because it is too large
Load Diff
51
js/index.js
51
js/index.js
@@ -1,4 +1,55 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
|
// ============================================
|
||||||
|
// 滚动动画效果 - Intersection Observer
|
||||||
|
// ============================================
|
||||||
|
function initScrollAnimations() {
|
||||||
|
const observerOptions = {
|
||||||
|
threshold: 0.1,
|
||||||
|
rootMargin: '0px 0px -50px 0px'
|
||||||
|
};
|
||||||
|
|
||||||
|
const observer = new IntersectionObserver((entries) => {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
entry.target.classList.add('animated');
|
||||||
|
// 一次性动画,触发后不再观察
|
||||||
|
observer.unobserve(entry.target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, observerOptions);
|
||||||
|
|
||||||
|
// 为所有section添加滚动动画
|
||||||
|
document.querySelectorAll('.section').forEach((section, index) => {
|
||||||
|
section.classList.add('animate-on-scroll');
|
||||||
|
observer.observe(section);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为服务卡片添加延迟动画
|
||||||
|
document.querySelectorAll('.service-box').forEach((box, index) => {
|
||||||
|
box.classList.add('animate-on-scroll', `delay-${(index % 3) + 1}`);
|
||||||
|
observer.observe(box);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为解决方案卡片添加动画
|
||||||
|
document.querySelectorAll('.resolve-box').forEach((box, index) => {
|
||||||
|
box.classList.add('animate-on-scroll', `delay-${(index % 4) + 1}`);
|
||||||
|
observer.observe(box);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为新闻列表添加动画
|
||||||
|
document.querySelectorAll('.news-cont').forEach(cont => {
|
||||||
|
cont.classList.add('scale-on-scroll');
|
||||||
|
observer.observe(cont);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面加载完成后初始化动画
|
||||||
|
setTimeout(initScrollAnimations, 100);
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// 原有功能代码
|
||||||
|
// ============================================
|
||||||
|
|
||||||
// 获取url地址栏参数函数
|
// 获取url地址栏参数函数
|
||||||
function getUrlParams() {
|
function getUrlParams() {
|
||||||
const url = window.location.href;
|
const url = window.location.href;
|
||||||
|
|||||||
Reference in New Issue
Block a user