Chuyển đến nội dung

EAT là gì
document.addEventListener('DOMContentLoaded', function() {
const tocLinks = document.querySelectorAll('.elementor-toc__list-item a');
tocLinks.forEach(function(link) {
link.addEventListener('click', function(event) {
event.preventDefault();
const targetId = link.getAttribute('href').split('#')[1];
const targetElement = document.getElementById(targetId);
if (targetElement) {
const offset = targetElement.getBoundingClientRect().top + window.scrollY - 100; // Điều chỉnh nếu có header cố định
window.scrollTo({ top: offset, behavior: 'smooth' });
history.replaceState(null, null, window.location.pathname + window.location.search);
}
});
});
});