DEV Community

Discussion on: Fixed navigations and sections - here is scroll-padding

Collapse
 
oyegokepraise profile image
Emerald RLM

It conflicts with Javascript scroll to top

window.scrollTo(0,0 )

I had been making a trade-off between a scroll to top button and scroll padding, please respond if there is a way to resolve this conflict

Collapse
 
einlinuus profile image
EinLinuus

My idea would be to calculate the height of your header/navigation (with JS) and scroll to that position. If your header is 100px height, then scroll to 100px on the Y axis instead of 0. That's the only idea I have currently :/