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 = () => {
4949 const sidebarButton = document.createElement("div")
5050 sidebarButton.id = "sidebarbutton"
5151{% endif %}
52+ const sidebarMinWidth = 200
53+ const sidebarMaxWidth = Math.round(0.5 * window.innerWidth)
54+
5255 sidebarbutton.innerHTML = ""
5356 sidebarbutton.tabindex = "0" // make it focusable
5457 sidebarbutton.role = "slider"
@@ -60,7 +63,10 @@ const initialiseSidebar = () => {
6063 function onMouseMove(e) {
6164 e.preventDefault()
6265 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+ )
6470 clientX = e.clientX
6571 sidebar.style.width = `${newWidth}px`
6672 bodyWrapper.style.marginLeft = `${newWidth}px`
You can’t perform that action at this time.
0 commit comments