I m using the scrollIntoView
function to go from one section to another on my webpage.
I would using some function to adjust the scroll. Currently the scroll make the section appear at top of page but my fixed top menu then hide a part of the section.
To make the section fully displayed on the page after the scrollIntoView
I have tried to use the function window.scrollBy
to make the scrollY backs on top of 150px, hence revealing the previously hidden part of the element.
But it fails.
Here my snippet:
scrollToElement = (target)=> {
target.scrollIntoView({behavior: 'smooth'})
// window.scrollBy(0,-150)
}
How adjust my scrollIntoView please?
Any hint would be great, thanks