I have implemented the code to change "active" class of menu when page scrolling.
Here is the code I use to manage this behavior :
$(