File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ <h3>{{ _('Navigation') }}</h3>
7878 < script type ="text/javascript " src ="{{ pathto('_static/menu.js', 1) }} "> </ script >
7979 < script type ="text/javascript " src ="{{ pathto('_static/search-focus.js', 1) }} "> </ script >
8080 < script type ="text/javascript " src ="{{ pathto('_static/themetoggle.js', 1) }} "> </ script >
81+ < script type ="text/javascript " src ="{{ pathto('_static/sidebar-resizer.js', 1) }} "> </ script >
8182 {%- endif -%}
8283 {%- endif -%}
8384 {{ super() }}
Original file line number Diff line number Diff line change @@ -149,6 +149,9 @@ div.sphinxsidebar {
149149 border-radius : 5px ;
150150 line-height : 130% ;
151151 font-size : smaller;
152+ width : 300px ;
153+ resize : horizontal;
154+ overflow : auto;
152155}
153156
154157div .sphinxsidebar h3 ,
@@ -157,7 +160,7 @@ div.sphinxsidebar h4 {
157160}
158161
159162div .sphinxsidebarwrapper {
160- width : 217 px ;
163+ width : 100 % ;
161164 box-sizing : border-box;
162165 height : 100% ;
163166 overflow-x : hidden;
Original file line number Diff line number Diff line change 1+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
2+ const sidebar = document . querySelector ( '.sphinxsidebar' ) ;
3+ const resizer = document . createElement ( 'div' ) ;
4+ resizer . className = 'sidebar-resizer' ;
5+ sidebar . appendChild ( resizer ) ;
6+
7+ resizer . addEventListener ( 'mousedown' , function ( e ) {
8+ document . addEventListener ( 'mousemove' , resizeSidebar ) ;
9+ document . addEventListener ( 'mouseup' , stopResize ) ;
10+ } ) ;
11+
12+ function resizeSidebar ( e ) {
13+ const newWidth = e . clientX - sidebar . getBoundingClientRect ( ) . left ;
14+ if ( newWidth > 150 && newWidth < window . innerWidth - 100 ) {
15+ sidebar . style . width = newWidth + 'px' ;
16+ }
17+ }
18+
19+ function stopResize ( ) {
20+ document . removeEventListener ( 'mousemove' , resizeSidebar ) ;
21+ document . removeEventListener ( 'mouseup' , stopResize ) ;
22+ }
23+ } ) ;
You can’t perform that action at this time.
0 commit comments