File size: 1,566 Bytes
b49b631 4c55146 b49b631 4c55146 | 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 |
// Parallax effect for stars
document.addEventListener('mousemove', (e) => {
const stars = document.querySelector('.stars');
const twinkling = document.querySelector('.twinkling');
const x = e.clientX / window.innerWidth;
const y = e.clientY / window.innerHeight;
stars.style.transform = `translate(-${x * 30}px, -${y * 30}px)`;
twinkling.style.transform = `translate(-${x * 15}px, -${y * 15}px)`;
});
document.addEventListener('DOMContentLoaded', function() {
// Initialize tooltips
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
// Color generator functionality
const generateBtn = document.querySelector('.bg-primary-600');
if (generateBtn) {
generateBtn.addEventListener('click', function() {
const colorCards = document.querySelectorAll('.h-16');
colorCards.forEach(card => {
const randomColor = Math.floor(Math.random()*16777215).toString(16);
card.style.backgroundColor = `#${randomColor}`;
});
});
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
}); |