Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting fails of highlights wrong item #34

Closed
andrekampert opened this issue Jul 10, 2013 · 2 comments
Closed

Highlighting fails of highlights wrong item #34

andrekampert opened this issue Jul 10, 2013 · 2 comments
Assignees

Comments

@andrekampert
Copy link
Contributor

There are two symptoms of a problem with highlighting:

Highlighting not updated

When scrolling larger pages really fast, sometimes the highlighting is not updated due to events being skipped. This is because for some reason we never get a position within the offset, so the update is skipped entirely (line 622)

javascript
if ((Math.abs($(this).offset().top - winScrollTop) < self.options.highlightOffset))

#### Highlight wrong item after clicking in toc

Sometimes, based on the structure of the page, another item is highlighted in the TOC, because after scrolling tocify consider an item on top within the highlightOffset. However, the item below is closer, so should be highlighted instead of the first item within the highlightOffset.
#### Proposed solution

Instead of the first element within the highlightOffset, use the one closest to the current position. I've made this improvement in a fork and will create a pull request.
@ghost ghost assigned gfranko Jul 10, 2013
@gfranko
Copy link
Owner

gfranko commented Jul 10, 2013

@andrekampert I'm really looking forward to your PR! Just make sure to send it to the dev branch =)

@andrekampert
Copy link
Contributor Author

I just pushed the changes and created a PR. Nice work BTW, I really like the way this menu works.

@gfranko gfranko closed this as completed Jul 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants