1

I made a fixed navigation bar header that when I press the buttons it goes to certain point of my page, but it doesn't considers its own height I mean: enter image description here enter image description here

enter image description here

I searched, but didn't found the answer, I even tried manually move it in a desesperation attempt:

let buttons = document.querySelectorAll('.navigation a');

let func = () => {
    setTimeout(() => {
        window.scrollY = window.scrollY + header.offsetHeight
    }, 1000);
}

buttons.forEach((element) => {
    element.addEventListener("click", func)
});

but didn't work either, how can I do it?

HerlySQR
  • 94
  • 8
  • 1
    Found solutions for this issue [here](https://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header) and [here](https://stackoverflow.com/questions/4086107/fixed-page-header-overlaps-in-page-anchors) – PsiKai Sep 11 '22 at 03:06
  • 1
    Does this answer your question? [Fixed page header overlaps in-page anchors](https://stackoverflow.com/questions/4086107/fixed-page-header-overlaps-in-page-anchors) – Rohit Gupta Sep 11 '22 at 03:13
  • I don't know why I don't choose the correct words to search, thanks. – HerlySQR Sep 11 '22 at 15:13

0 Answers0