A
A
Ainur Shakirov2018-06-11 09:52:01
css
Ainur Shakirov, 2018-06-11 09:52:01

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

2 answer(s)
O
Oleg Dobrygin, 2018-06-13
@Fqyeh29

https://abouolia.github.io/sticky-sidebar/examples...

A
Andrey, 2018-06-11
@andrey_koyta

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 question

Ask a Question

731 491 924 answers to any question