garthenweb / react-stickup

React components to stick elements at the top of the page while scrolling
http://garthenweb.github.io/react-stickup
MIT License
24 stars 4 forks source link

api for estimated offsets for a given scroll position #9

Open garthenweb opened 6 years ago

garthenweb commented 6 years ago

When using window.scrollTo to scroll to a specific position in the application the developer needs to know in advance how large the offset will be so that the element is not hidden by a sticky element. A public api to estimate this position by x and y coordinates would solve this need.

garthenweb commented 3 years ago

Instead of a public API, adding scroll-margin by default might even be a better approach as it would make scrollTo work by default (I guess): https://css-tricks.com/almanac/properties/s/scroll-margin/