Spaces:
Running
Running
File size: 3,518 Bytes
db2d741 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | // 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) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Parallax effect for hero section
window.addEventListener('scroll', () => {
const scrolled = window.pageYOffset;
const parallax = document.querySelector('.nature-overlay');
if (parallax) {
parallax.style.transform = `translateY(${scrolled * 0.5}px)`;
}
});
// Liquid hover effects
const liquidCards = document.querySelectorAll('.liquid-card, .liquid-button');
liquidCards.forEach(card => {
card.addEventListener('mouseenter', (e) => {
const rect = e.target.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
e.target.style.setProperty('--mouse-x', `${x}px`);
e.target.style.setProperty('--mouse-y', `${y}px`);
});
});
// Intersection Observer for animations
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('animate-fade-in');
}
});
}, observerOptions);
document.querySelectorAll('.liquid-card').forEach(card => {
observer.observe(card);
});
// Dynamic glass effect based on mouse position
document.addEventListener('mousemove', (e) => {
const liquidElements = document.querySelectorAll('.liquid-glass-bg, .liquid-card, .liquid-button');
const x = e.clientX / window.innerWidth;
const y = e.clientY / window.innerHeight;
liquidElements.forEach(element => {
if (element.classList.contains('liquid-glass-bg')) {
element.style.background = `linear-gradient(${135 + x * 45}deg,
rgba(34, 197, 94, ${0.1 + y * 0.1}) 0%,
rgba(59, 130, 246, ${0.1 + x * 0.1}) 50%,
rgba(168, 85, 247, ${0.1 + y * 0.1}) 100%)`;
}
});
});
// Ripple effect on button click
document.querySelectorAll('.liquid-button').forEach(button => {
button.addEventListener('click', (e) => {
const ripple = document.createElement('span');
const rect = button.getBoundingClientRect();
const size = Math.max(rect.width, rect.height);
const x = e.clientX - rect.left - size / 2;
const y = e.clientY - rect.top - size / 2;
ripple.style.cssText = `
position: absolute;
width: ${size}px;
height: ${size}px;
left: ${x}px;
top: ${y}px;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
transform: scale(0);
animation: ripple 0.6s ease-out;
pointer-events: none;
`;
button.style.position = 'relative';
button.style.overflow = 'hidden';
button.append.appendChild(ripple);
setTimeout(() => ripple.remove(), 600);
});
});
// Add ripple animation
const style = document.createElement('style');
style.textContent = `
@keyframes ripple {
to {
transform: scale(4);
opacity: 0;
}
}
`;
document.head.appendChild(style); |