Spaces:
Running
Running
File size: 1,149 Bytes
2c0526e | 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 | document.addEventListener('DOMContentLoaded', () => {
// Initialize tooltips
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
// Animate elements on scroll
const animateOnScroll = () => {
const elements = document.querySelectorAll('.fade-in, .slide-up');
elements.forEach(el => {
const elementPosition = el.getBoundingClientRect().top;
const screenPosition = window.innerHeight / 1.2;
if(elementPosition < screenPosition) {
el.style.opacity = '1';
el.style.transform = 'translateY(0)';
}
});
};
window.addEventListener('scroll', animateOnScroll);
animateOnScroll(); // Run once on load
});
// Format currency
function formatCurrency(amount) {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 0,
maximumFractionDigits: 0
}).format(amount);
} |