B
B
bullyy2016-01-21 11:26:49
Angular
bullyy, 2016-01-21 11:26:49

How to get the current block when scrolling the page?

I made a menu, when you click on an element of which the page scrolls to the desired block. But how to make it possible to determine which block the user is currently seeing when scrolling the page on its own and highlight it in the menu?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2016-01-21
@bullyy

Listen to the onscroll event, compare the scrollTop value with the values ​​from the offset() blocks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question