Spaces:
Running
Running
Create a website with liquid glass backgrounds and minimalistic nature backgrounds. For a tech business website
db2d741 verified Download script.js from QWERTYasdgf/aquatech-nexus: direct link, hf CLI and curl.
- Browser
- Download file 3.52 kB
-
https://huggingface.co/spaces/QWERTYasdgf/aquatech-nexus/resolve/main/script.js
- Command line
-
hf download hf://spaces/QWERTYasdgf/aquatech-nexus/script.js
-
curl -L -o script.js https://huggingface.co/spaces/QWERTYasdgf/aquatech-nexus/resolve/main/script.js
3.52 kB
| // 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); |