Scrolls both window and container
denkristoffer opened this issue Β· comments
Hi π Thanks for making this library!
I'm using it to scroll a list that has overflow-y: scroll
. However, when scrolling to an element on the bottom of this list the window is scrolled to the bottom as well. Is there a way to avoid this or is it a bug?
Yes you can prevent it by using an undocumented 4th argument:
scrollIntoViewIfNeeded(
activeNode,
false,
{
duration: 150
},
activeNode
)
In the next major release we'll have 2 arguments instead of 5 (!) like now π
The 4th argument acts as a boundary. It works similar to the jquery $.closest
api in that it recurses from your element and up the tree until it reaches the window.
Let me know if it works for you π
Oh I see now, sorry for not digging further into the code. It works perfectly π Thanks!
No worries at all π This should've been documented tbh (and it will be soon) π