I'm using the Jquery standalaone implementation of Scrollspy. I have a jsfiddle example of my issue here: http://jsfiddle.net/2acyu/66/
The top nav links are highlighted as the page scrolls down through the 3 sections.
Works fine!
My problem is I want to have some hidden elements that can be toggled. When some additional content is shown and one of the sections is expanded it throws out the scrollspy. Try exanding the hidden text and then scrolling down. The link to text 2 is highlighted before this section reaches the top of the page since the offset values of the container div have changed.
The Bootstrap version of scrollSpy has a "refresh" method that can be called when elements in the DOM are added/changed to fix this situation. However the standalone JQuery version of Scrollspy that I'm using doesn't.
Someone here on another site suggests using:
$(window).unbind("scroll");
and then recreate the widget.
But I'm not sure how to implement this fix.
Any help appreciated.