mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
Attach sidebar-close handler to current-page links
This is intended primarily to resolve a problem with `singlehtml` documentation projects when viewed on narrow (typically mobile) displays. Under those circumstances, the `.current` CSS selector does not match any sidebar menu elements, because there is no logical notion of a 'current' page in `singlehtml` -- every item is on the same page. Therefore this change proposes an alternative way to identify sidebar links that are 'current' -- it checks for anchors that have an `href` beginning with the query-string fragment identifier (`#`). This is intended to be compatible with both `singlehtml` and `html` project builds. It depends upon sphinx-doc/sphinx#12551
This commit is contained in:
parent
7b894f5e7a
commit
fc13e477f5
File diff suppressed because one or more lines are too long
@ -86,7 +86,7 @@ function ThemeNav () {
|
||||
})
|
||||
|
||||
// Nav menu link click operations
|
||||
.on('click', ".wy-menu-vertical .current ul li a", function() {
|
||||
.on('click', ".wy-menu-vertical ul li a[href^='#']", function() {
|
||||
var target = $(this);
|
||||
// Close menu when you click a link.
|
||||
$("[data-toggle='wy-nav-shift']").removeClass("shift");
|
||||
|
Loading…
Reference in New Issue
Block a user