I have a sidebar menu in plain html for page navigation, like this:
<div class="sidebar"><h2>About us</h2>
<h3><a href="#chapter1" class="link">Chapter 1</a></h3>
<h3><a href="#chapter2" class="link">Chapter 2</a></h3>
<h3><a href="#chapter3" class="link">Chapter 3</a></h3>
</div>
Currently, when a visitor clicks on Chapter 1, they are taken to the Chapter 1 section and the Chapter 1 link in the sidebar changes color temporarily due to a:active delay.
However, I am trying to find a way to have the link in the sidebar change color when the visitor is on the specific section. For example, when they scroll down to Chapter 2, the Chapter 1 link color should revert to normal and the Chapter 2 link color should change.
Any suggestions or solutions would be greatly appreciated!
Update: I am working with a Wordpress website, and the suggestions provided so far have not worked as the sidebar is a Wordpress sidebar with a fixed position.