File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ const initialiseSidebar = () => {
49
49
const sidebarButton = document.createElement("div")
50
50
sidebarButton.id = "sidebarbutton"
51
51
{% endif %}
52
+ const sidebarMinWidth = 200
53
+ const sidebarMaxWidth = Math.round(0.5 * window.innerWidth)
54
+
52
55
sidebarbutton.innerHTML = ""
53
56
sidebarbutton.tabindex = "0" // make it focusable
54
57
sidebarbutton.role = "slider"
@@ -60,7 +63,10 @@ const initialiseSidebar = () => {
60
63
function onMouseMove(e) {
61
64
e.preventDefault()
62
65
const sidebarWidth = sidebar.offsetWidth
63
- const newWidth = Math.max(0, Math.min(window.innerWidth, sidebarWidth + e.clientX - clientX))
66
+ const newWidth = Math.max(
67
+ sidebarMinWidth,
68
+ Math.min(sidebarMaxWidth, sidebarWidth + e.clientX - clientX)
69
+ )
64
70
clientX = e.clientX
65
71
sidebar.style.width = `${newWidth}px`
66
72
bodyWrapper.style.marginLeft = `${newWidth}px`
You can’t perform that action at this time.
0 commit comments