-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Scroll navigation to show the link to the current page #639
Conversation
After loading the page, find the link to it in the site nav, then scroll if needed. Fixes just-the-docs#570.
I have no previous experience of writing JS, but this appears to work. Suggestions for improvement are welcome! |
Not working on links with expanders
Support the following: - The page location and/or the hrefs in the nav might have a trailing slash. - The landing page isn't in the site-nav element. All nav links in the JtD site now remain visible when clicked, as intended.
Screenshot after step 4 in #570: All nav links in the JtD site now remain visible when clicked, as intended, without any JS errors. |
I have a docs site with a lot of navigation items as well; I made an extra tweak to this pull request on a fork to preference the user's previous scroll position over the calculated position if the menu item is still visible to the user: rapid7#1 I'd be happy to send that work over as a new pull request for your consideration, either to your branch, or the combination branch, or I can wait until the 0.4.0 release is confirmed 👍 |
@adfoster-r7 many thanks for the improvements proposed in rapid7#1.
@mattxwang is currently considering whether the combination branch could be merged into the forthcoming v0.4.0 release, so I should avoid updating it at present. However, I think it would be good if you submit a PR to the combination branch. The In any case, I suppose I can test your proposed improvements by using your PR branch as a remote theme. But I don't know enough about the use of JS in Just the Docs to review your PR code myself. |
Missed this on my first round, but I believe this was merged in to the RC by way of #578. @pdmosses feel free to reopen if I've made a mistake! p.s. I accidentally made a mistake in updating this branch by duplicating the bundler line in the gemspec - if you do need to reopen, feel free to quickly update that line! |
@mattxwang yes, this was indeed included in #578, see my comment there.
@adfoster-r7 the combination branch has been merged in RC |
After loading the page, find the link to it in the site nav, then scroll if needed.
Fixes #570.