A
A
Amir Davlatov2020-04-30 19:20:54
css
Amir Davlatov, 2020-04-30 19:20:54

How to make a section transition indicator on a website?

I asked a similar question, but I did not formulate it correctly and did not get a good answer. In short, I need to make a side section transition indicator. It should be fixed on the screen and when you move to another section, the black indicator should move to another part of the menu. Please help me understand how such indicators are made5eaafaa518247365801172.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-05-03
@Tryhard770

1. You should start by listening to the scroll
2. Then calculate if the scroll matches the coordinates of the section .
3. If there is a match, get the index of the corresponding element in your navigation in any convenient way (you can distribute it through data-attributes, or just catch the current index [it will get worse with different nesting]). And set a class for it (for highlighting).
The navigation itself should be positioned with position:fixed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question