By further reading, this is the functionality of BootStrap.
For Chinese tutorial, maybe W3C school provides the best one – http://www.w3cschool.cc/bootstrap/bootstrap-scrollspy-plugin.html
The specific component is “ScrollSpy”
solved How to change element CSS class when different part of web page is present?