Spaces:
Running
Running
File size: 3,066 Bytes
8e33b88 9b97644 8e33b88 9b97644 8e33b88 9b97644 8e33b88 9b97644 8e33b88 9b97644 | 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 |
document.addEventListener('DOMContentLoaded', function() {
// Navbar scroll effect
const navbar = document.querySelector('custom-navbar').shadowRoot.querySelector('.navbar');
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
navbar.classList.add('scrolled');
} else {
navbar.classList.remove('scrolled');
}
});
// Smooth scroll for anchor links
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'
});
}
});
});
// Countdown timer
const countdown = () => {
const countdownDate = new Date();
countdownDate.setDate(countdownDate.getDate() + 3);
const timer = setInterval(() => {
const now = new Date().getTime();
const distance = countdownDate - now;
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('countdown').innerHTML = `${days}d ${hours}h ${minutes}m ${seconds}s`;
if (distance < 0) {
clearInterval(timer);
document.getElementById('countdown').innerHTML = "OFFER EXPIRED!";
}
}, 1000);
};
countdown();
// Animate elements when they come into view
const animateOnScroll = () => {
const elements = document.querySelectorAll('.animate-fade, .animate-slide-up, .animate-slide-left, .animate-slide-right');
elements.forEach(element => {
const elementPosition = element.getBoundingClientRect().top;
const screenPosition = window.innerHeight / 1.2;
if (elementPosition < screenPosition) {
element.classList.add('animate-active');
}
});
};
window.addEventListener('scroll', animateOnScroll);
animateOnScroll();
// Copy trading matrix
document.querySelectorAll('.copy-matrix').forEach(button => {
button.addEventListener('click', () => {
const matrix = document.getElementById('trading-matrix').textContent;
navigator.clipboard.writeText(matrix);
const originalText = button.textContent;
button.textContent = "Copied!";
button.classList.add('bg-green-500');
setTimeout(() => {
button.textContent = originalText;
button.classList.remove('bg-green-500');
}, 2000);
});
});
}); |