File size: 2,854 Bytes
6b8dc36 |
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 |
// Shared JavaScript across all pages
// Countdown timer for launch date
function updateCountdown() {
const launchDate = new Date('2024-03-01T00:00:00').getTime();
const now = new Date().getTime();
const distance = launchDate - now;
if (distance < 0) {
document.getElementById('countdown').innerHTML = '<div class="text-2xl font-bold text-primary-600">We\'re Live! 🎉</div>';
return;
}
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
document.getElementById('days').textContent = days.toString().padStart(2, '0');
document.getElementById('hours').textContent = hours.toString().padStart(2, '0');
document.getElementById('minutes').textContent = minutes.toString().padStart(2, '0');
document.getElementById('seconds').textContent = seconds.toString().padStart(2, '0');
}
// Initialize countdown
updateCountdown();
setInterval(updateCountdown, 1000);
// Add floating animation to random elements
document.addEventListener('DOMContentLoaded', function() {
const floatElements = document.querySelectorAll('.transform');
floatElements.forEach((element, index) => {
element.style.animationDelay = `${index * 0.2}s`;
});
});
// Add sparkle effect to headings
function addSparkleEffect() {
const headings = document.querySelectorAll('h1, h2');
headings.forEach(heading => {
heading.classList.add('sparkle-animation');
});
}
// Initialize sparkle effect
addSparkleEffect();
// Smooth scroll to elements
function smoothScrollTo(element) {
element.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
// Add interactive hover effects
document.addEventListener('DOMContentLoaded', function() {
const craftItems = document.querySelectorAll('.bg-white\\/80');
craftItems.forEach(item => {
item.addEventListener('mouseenter', function() {
this.style.transform = 'scale(1.05) rotate(2deg)';
this.style.transition = 'all 0.3s ease';
});
item.addEventListener('mouseleave', function() {
this.style.transform = 'scale(1) rotate(0deg)';
});
});
});
// Handle responsive adjustments
function handleResize() {
const vantaElement = document.getElementById('vanta-background');
if (window.innerWidth < 768 && vantaElement) {
vantaElement.style.display = 'none';
} else if (vantaElement) {
vantaElement.style.display = 'block';
}
}
// Initialize resize handler
window.addEventListener('resize', handleResize);
handleResize(); // Call initially
console.log('Kenza\'s Skatter - Coming Soon Page Loaded! 🎨'); |