mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-24 12:48:55 +00:00
docs: Don't hide the version selector when scrolling down
This commit is contained in:
parent
25117d7d01
commit
5c5f03ac56
2 changed files with 25 additions and 0 deletions
22
docs/extra.js
Normal file
22
docs/extra.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
document$.subscribe(function () {
|
||||
// Stop mkdocs-material from hiding the version selector when scrolling down;
|
||||
// this is done by removing the --active class when mkdocs-material adds it.
|
||||
// (--active = scrolled down)
|
||||
|
||||
const title = document.querySelector('*[data-md-component="header-title"]');
|
||||
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
if (mutation.attributeName === "class") {
|
||||
const classList = title.className.split(" ");
|
||||
classList.forEach((className) => {
|
||||
if (className.endsWith("--active")) {
|
||||
title.classList.remove(className);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(title, { attributes: true });
|
||||
});
|
|
@ -84,6 +84,9 @@ markdown_extensions:
|
|||
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
||||
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
||||
|
||||
extra_javascript:
|
||||
- extra.js
|
||||
|
||||
# This lists all the files that become part of the documentation
|
||||
nav:
|
||||
- 'Home': 'index.md'
|
||||
|
|
Loading…
Reference in a new issue