2026-01-27 14:35:19 +00:00

43 lines
1.8 KiB
JavaScript

document.addEventListener('DOMContentLoaded', () => {
// 1. Cursor Follower (PC Only)
const cursor = document.querySelector('.cursor-follower');
if (cursor && window.innerWidth > 992) {
document.addEventListener('mousemove', (e) => {
cursor.style.left = e.clientX + 'px';
cursor.style.top = e.clientY + 'px';
});
document.querySelectorAll('a, .glass-card, .tactic-card').forEach(el => {
el.addEventListener('mouseenter', () => cursor.classList.add('active'));
el.addEventListener('mouseleave', () => cursor.classList.remove('active'));
});
}
// 2. Smooth Scroll for Navigation
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
window.scrollTo({
top: target.offsetTop - 80,
behavior: 'smooth'
});
}
});
});
// 3. Parallax Effect for Orbs
window.addEventListener('scroll', () => {
const scrolled = window.pageYOffset;
const orbGold = document.querySelector('.orb-gold');
const orbBlack = document.querySelector('.orb-black');
if (orbGold) orbGold.style.transform = `translate(${scrolled * 0.1}px, ${scrolled * 0.05}px)`;
if (orbBlack) orbBlack.style.transform = `translate(${-scrolled * 0.05}px, ${scrolled * 0.1}px)`;
});
// 4. Console Welcome Message (Developer branding)
console.log('%c 财神组内部系统 %c v2.0 ', 'background:#d4af37; color:#000; font-weight:bold; padding:5px; border-radius:3px 0 0 3px;', 'background:#222; color:#d4af37; padding:5px; border-radius:0 3px 3px 0;');
});