This commit is contained in:
Francesco Picone
2025-12-06 18:34:12 +01:00
parent 1f48a3a2a5
commit f59d24bdce
3 changed files with 32 additions and 2 deletions

View File

@@ -27,6 +27,23 @@ document.addEventListener('DOMContentLoaded', function() {
});
});
// Scroll smooth per link con anchor
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
const href = this.getAttribute('href');
if (href !== '#' && href.length > 1) {
e.preventDefault();
const target = document.querySelector(href);
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
}
});
});
});
/**