20 lines
635 B
JavaScript
20 lines
635 B
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const navLinks = document.querySelectorAll('a.nav-link[href^="#"]');
|
|
navLinks.forEach((link) => {
|
|
link.addEventListener('click', (event) => {
|
|
const targetId = link.getAttribute('href');
|
|
const target = document.querySelector(targetId);
|
|
if (target) {
|
|
event.preventDefault();
|
|
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
}
|
|
});
|
|
});
|
|
|
|
const toastEl = document.querySelector('.toast');
|
|
if (toastEl && window.bootstrap) {
|
|
const toast = new bootstrap.Toast(toastEl, { delay: 4000 });
|
|
toast.show();
|
|
}
|
|
});
|