aboutsummaryrefslogtreecommitdiffhomepage
path: root/book.js
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2025-02-20 19:41:10 +0000
committerjohannst <johannst@users.noreply.github.com>2025-02-20 19:41:10 +0000
commit5a3e8872283eb758816b1547a98f52a251e4d31e (patch)
tree90a858d9a9eea0af6a3644b5c99a96f34372da74 /book.js
parent267bb0d3d2b7ba892f8f5d88f14f1be1aac0df11 (diff)
downloadnotes-5a3e8872283eb758816b1547a98f52a251e4d31e.tar.gz
notes-5a3e8872283eb758816b1547a98f52a251e4d31e.zip
deploy: 496a4126f52649ea954ce6be2cdfeb1d7a02c372
Diffstat (limited to 'book.js')
-rw-r--r--book.js13
1 files changed, 4 insertions, 9 deletions
diff --git a/book.js b/book.js
index 178f1e9..a5c2555 100644
--- a/book.js
+++ b/book.js
@@ -449,6 +449,7 @@ function playground_text(playground, hidden = true) {
var sidebar = document.getElementById("sidebar");
var sidebarLinks = document.querySelectorAll('#sidebar a');
var sidebarToggleButton = document.getElementById("sidebar-toggle");
+ var sidebarToggleAnchor = document.getElementById("sidebar-toggle-anchor");
var sidebarResizeHandle = document.getElementById("sidebar-resize-handle");
var firstContact = null;
@@ -475,22 +476,16 @@ function playground_text(playground, hidden = true) {
}
// Toggle sidebar
- sidebarToggleButton.addEventListener('click', function sidebarToggle() {
- if (body.classList.contains("sidebar-hidden")) {
+ sidebarToggleAnchor.addEventListener('change', function sidebarToggle() {
+ if (sidebarToggleAnchor.checked) {
var current_width = parseInt(
document.documentElement.style.getPropertyValue('--sidebar-width'), 10);
if (current_width < 150) {
document.documentElement.style.setProperty('--sidebar-width', '150px');
}
showSidebar();
- } else if (body.classList.contains("sidebar-visible")) {
- hideSidebar();
} else {
- if (getComputedStyle(sidebar)['transform'] === 'none') {
- hideSidebar();
- } else {
- showSidebar();
- }
+ hideSidebar();
}
});