main.js: fix scroll

Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
rodrigo committed 2026-02-23 15:24:20 -03:00
1 parent 6904171303
commit 486a8b6ba4
1 file changed
+9 -3
+9 -3
View File
@@ -217,9 +217,15 @@
if (target) { if (target) {
e.preventDefault(); e.preventDefault();
target.scrollIntoView({
behavior: 'smooth', // Calcular altura do header para ajustar o offset
block: 'start' const headerHeight = elements.header ? elements.header.offsetHeight : 0;
const targetPosition = target.getBoundingClientRect().top + window.pageYOffset;
const offsetPosition = targetPosition - headerHeight - 20; // 20px de margem extra
window.scrollTo({
top: offsetPosition,
behavior: 'smooth'
}); });
} }
}); });