lcdsantos / menuspy

A JavaScript library to make navigation menus highlight the item based on currently in view section.
https://leocs.me/menuspy/
MIT License
303 stars 38 forks source link

How to refresh/update calculations ? #17

Closed fluxxus closed 5 years ago

fluxxus commented 5 years ago

I am using menuspy with scrollmagic library. Since scrollmagic creates pinned scenes, it changes the height of each scene when one is activated by scrolling to its position.

I would like to have menuspy update its calculations when a scene is activated, because right now it is not aware of changed dimensions and it goes through whole navigation while I am basically just scrolling through one of the sections.

I can put up an online demo of needed.

fluxxus commented 5 years ago

This may be the quickest closed github issue ever. It seems that scrollmagic is smart enough that it calculates everything beforehand, even though the scene is not actually activated yet.

I am initialising menuspy after those calculations and now it works perfectly.