jimmynotjim / scrollnav

A dependency free JavaScript plugin for auto generating single page navigation
http://scrollnav.com
MIT License
461 stars 127 forks source link

Fixed active state when scrolling #16

Closed jimmynotjim closed 11 years ago

jimmynotjim commented 11 years ago

This PR fixes the issues addressed in #14. Now instead of testing the heading's position, the plugin tests the location of the beginning and end of each section against an "inner viewport". The offset of this inner viewport from the top and bottom of the actual window is adjustable with the option scrollOffset. This option also controls the scrolling location when selecting a nav link. Any section within the bounds of this inner viewport will be set to active, meaning if there are 4 short sections within this window, all of them will show as active (see the homepage for an example of how this is currently broken).

NOTES: This PR is dependent on the new naming conventions and sectioning of the articles markup set up in #13. Do not attempt to merge before merging #13.

jimmynotjim commented 11 years ago

Tested all options without any errors.