Open brendanheywood opened 12 years ago
I experience the same issue on the link you referenced—the highlightOnScroll
option often highlights the wrong item.
+1 on your proposal to detect hitting page-bottom and override the highlightOnScroll feature in that case.
Test case:
http://projects.jga.me/toc/#toc0
Click on any menu item that refers to an item that is within one page height of the bottom of the document, so on my screen these include History down to Contributions. It then smooth scrolls down to this item, but then when the menu highlight code kicks in it detects that it is only up to the Example CSS section which is the first section visible on the page.
I'd just test if the page bottom was hit as part of the scroll and if so explicitly set the menu item to highlight the on that was just clicked and not do the current location detection.