Update Navigation Items Based On Scroll Position – ScrollSpy.js
A small pure JavaScript scrollspy library that automatically highlights navigation items based upon scroll position to indicate which content section is currently active in the viewport.