1
0
mirror of https://github.com/funkypenguin/geek-cookbook/ synced 2025-12-13 17:56:26 +00:00
Files
geek-cookbook/manuscript/extras/javascript/auto-expand-nav.js
David Young 395046c3db Bump version of material-mkdocs
Signed-off-by: David Young <davidy@funkypenguin.co.nz>
2020-04-20 13:27:02 +12:00

27 lines
754 B
JavaScript

document.addEventListener("DOMContentLoaded", function() {
load_navpane();
});
function load_navpane() {
var width = window.innerWidth;
if (width <= 1200) {
return;
}
var nav = document.getElementsByClassName("md-nav");
for(var i = 0; i < nav.length; i++) {
if (typeof nav.item(i).style === "undefined") {
continue;
}
if (nav.item(i).getAttribute("data-md-level") && nav.item(i).getAttribute("data-md-component")) {
nav.item(i).style.display = 'block';
nav.item(i).style.overflow = 'visible';
}
}
var nav = document.getElementsByClassName("md-nav__toggle");
for(var i = 0; i < nav.length; i++) {
nav.item(i).checked = true;
}
}