Currently I have a position: fixed TOC in my side bar that the user can click on to jump to a different (a name="(1, 2, ,3 ,etc)") on the page. This adds a class of "currentlyReading" to the selected li.. When the user clicks another li in the TOC, it of course removes the class and adds the class to the li the user selected.
What I have been trying to add is this: when the user scrolls past the next (or previous) (a name="", I want the TOC to update with the current chapter the user is reading. That means, I need to remove the class of "currentlyReading" and assign that class to the li that is currently being read.
Any tips on how to accomplish this?