OzilDev's picture
create login page fully responsive with some animation for space rocket website
b49b631 verified
Raw History Blame Contribute Delete
1.57 kB
// 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'
});
});
});
});