vueloenglobo.mx/public/assets/js/aviso.js

20 lines
690 B
JavaScript

// Smooth scroll para la tabla de contenidos
document.querySelectorAll(".privacy-toc-link").forEach((anchor) => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
const targetId = this.getAttribute("href");
const targetElement = document.querySelector(targetId);
if (targetElement) {
const offset = 100;
const elementPosition = targetElement.getBoundingClientRect().top;
const offsetPosition =
elementPosition + window.pageYOffset - offset;
window.scrollTo({
top: offsetPosition,
behavior: "smooth",
});
}
});
});