kdp-magic-maker-pro / script.js
HM1234's picture
build this
4c260b4 verified
Raw History Blame Contribute Delete
865 Bytes
// Shared functionality across all pages
// Initialize tooltips for feather icons
document.addEventListener('DOMContentLoaded', function() {
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
});
});
// Smooth scroll for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Feature detection for modern browser features
if (!('IntersectionObserver' in window)) {
// Load polyfill or provide fallback
console.log('IntersectionObserver not supported');
}