mirror of
https://github.com/mkdocs/mkdocs.git
synced 2026-03-27 09:58:31 +07:00
Merge pull request #928 from d0ugal/master
Manually set the correct highlighted TOC item when the user clicks it
This commit is contained in:
@@ -29,6 +29,20 @@ $(document).ready(function() {
|
||||
// Highlight.js
|
||||
hljs.initHighlightingOnLoad();
|
||||
$('table').addClass('table table-striped table-hover');
|
||||
|
||||
// Improve the scrollspy behaviour when users click on a TOC item.
|
||||
$(".nav a").on("click", function() {
|
||||
var clicked = this;
|
||||
setTimeout(function() {
|
||||
var active = $('.nav li.active a');
|
||||
active = active[active.length - 1];
|
||||
if (clicked !== active) {
|
||||
$(active).parent().removeClass("active");
|
||||
$(clicked).parent().addClass("active");
|
||||
}
|
||||
}, 50);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user