Spaces:
Running
Running
| // Shared functionality across pages | |
| document.addEventListener('DOMContentLoaded', () => { | |
| console.log('Rotating Art Vortex loaded'); | |
| // Add vortex effect to main container | |
| const mainContainer = document.querySelector('main'); | |
| if (mainContainer) { | |
| mainContainer.classList.add('vortex-spin'); | |
| } | |
| // Initialize tooltips | |
| document.querySelectorAll('[data-tooltip]').forEach(el => { | |
| el.addEventListener('mouseenter', showTooltip); | |
| el.addEventListener('mouseleave', hideTooltip); | |
| }); | |
| // Animation triggers | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.classList.add('fade-in'); | |
| } | |
| }); | |
| }, { threshold: 0.1 }); | |
| document.querySelectorAll('.animate-on-scroll').forEach(el => { | |
| observer.observe(el); | |
| }); | |
| }); | |
| function showTooltip(e) { | |
| const tooltip = document.createElement('div'); | |
| tooltip.className = 'absolute bg-gray-800 text-white px-2 py-1 rounded text-sm z-50'; | |
| tooltip.textContent = this.dataset.tooltip; | |
| this.appendChild(tooltip); | |
| } | |
| function hideTooltip() { | |
| this.removeChild(this.lastChild); | |
| } |