Answer the question
In order to leave comments, you need to log in
Floating menu with scrolling, like in VK?
In groups in vk , the side menu (on the right) is fixed, but is screwed to its end and back if it is longer than the height of the window.
How to implement this? I rummaged through the pages of the page, did not find it.
Answer the question
In order to leave comments, you need to log in
There, JS switches the position: fixed class and, depending on the scrolling, margin-top (indent from above) changes, such as if the edge of the block has reached the edge of the viewport -> fixed, if both the top edge of the block and the bottom are not touching the edge of the viewport, then it is set margin-top of the current scroll (window.scrollY)
From this we
dance about clientHeight, offsetY and scrollTop
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question