I’m trying to build a dot navigation kind of thing, i.e., when you click on each "div" it takes you to the specific section, which is currently implemented.
But, also while scrolling I need to change the current state of this div’s to active. How do I do that?
An image on how the dot navigation looks.
I was looking how to get scroll positions of each section and assign them to each variables and run some function.
<div class="dot-navigation">
<div>
<a href="#home"></a>
</div>
<div>
<a href="#about"></a>
</div>
<div>
<a href="#services"></a>
</div>
<div>
<a href="#clients"></a>
</div>
<div>
<a href="#reviews"></a>
</div>
<div>
<a href="#contactus"></a>
</div>
</div>
2
Answers
Thanks, Angelina for your comment.
I found this to be useful https://www.youtube.com/watch?v=fAAk9CATILc
Listen for scroll events, find the currently displayed region, and highlight the navigation elements as necessary.