GD-Huggingfaces's picture
can you replicate this website: https://www.powerdesigninc.us
28dd233 verified
Raw History Blame Contribute Delete
1.6 kB
// Main JavaScript file for functionality
document.addEventListener('DOMContentLoaded', function() {
// Mobile menu toggle functionality will be handled by our header component
// 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'
});
});
});
// Initialize animations
const animateOnScroll = () => {
const elements = document.querySelectorAll('.animate-on-scroll');
elements.forEach(element => {
const elementPosition = element.getBoundingClientRect().top;
const screenPosition = window.innerHeight / 1.3;
if(elementPosition < screenPosition) {
element.classList.add('animate-fadeInUp');
}
});
};
window.addEventListener('scroll', animateOnScroll);
animateOnScroll(); // Run once on page load
// Project card hover effect
const projectCards = document.querySelectorAll('.project-card');
projectCards.forEach(card => {
card.addEventListener('mouseenter', () => {
card.querySelector('img').style.transform = 'scale(1.05)';
});
card.addEventListener('mouseleave', () => {
card.querySelector('img').style.transform = 'scale(1)';
});
});
// Testimonial carousel would be implemented here if needed
});