polymer-shield-pros / script.js
codekirk1's picture
ok pretty good, we dont do custom castings, we dont do polymer concrete enclosures, only covers for now, that page, "our Story" should link to "about us" everything else looks ok, resources tab should be drop down menu that displays a few more tabs, leave them open for renaming for now
35e2343 verified
Raw History Blame Contribute Delete
1.12 kB
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Simple scroll animation
const animateOnScroll = () => {
const elements = document.querySelectorAll('.fade-in, .product-card');
elements.forEach(element => {
const elementPosition = element.getBoundingClientRect().top;
const screenPosition = window.innerHeight / 1.2;
if (elementPosition < screenPosition) {
element.style.opacity = '1';
}
});
};
// Initialize animations
window.addEventListener('load', () => {
animateOnScroll();
});
// Add scroll event listener
window.addEventListener('scroll', animateOnScroll);