Closed
Description
Our application is a fixed size, with an internal div using overflow: scroll.
This means we aren't able to scroll to top, as the current implementation of scroll-behavior
assumes you are scrolling the window.
I have created a modified version where you are able to pass a target id
through to scroll-behavior
and instead scroll the target.
It is a pretty rough implementation. We are targeting an id with getElementById
as its faster, however it could easily be changed to use querySelector
and allow targeting by anything.
Just wondering if this would be useful to others? And their opinions on the best way to go about it.
You can have a look the hacky way I implemented on this gist.
(Main changes are Lines 107-114 and 172-179 of scroll-behavior.js)