File tree 3 files changed +45
-6
lines changed
3 files changed +45
-6
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ <h3>{{ _('Navigation') }}</h3>
78
78
< script type ="text/javascript " src ="{{ pathto('_static/menu.js', 1) }} "> </ script >
79
79
< script type ="text/javascript " src ="{{ pathto('_static/search-focus.js', 1) }} "> </ script >
80
80
< script type ="text/javascript " src ="{{ pathto('_static/themetoggle.js', 1) }} "> </ script >
81
+ < script type ="text/javascript " src ="{{ pathto('_static/sidebar-resizer.js', 1) }} "> </ script >
81
82
{%- endif -%}
82
83
{%- endif -%}
83
84
{{ super() }}
Original file line number Diff line number Diff line change 1
1
@import url ('classic.css' );
2
2
3
+ /* Smooth scroll */
4
+ html {
5
+ scroll-behavior : smooth;
6
+ }
7
+
3
8
/* Common colours */
4
9
: root {
5
10
--good-color : rgb (41 100 51 );
@@ -129,6 +134,7 @@ form.inline-search input[type='submit'] {
129
134
}
130
135
131
136
div .document {
137
+ animation : fadeIn 0.6s ease-in-out;
132
138
display : flex;
133
139
/* Don't let long code literals extend beyond the right side of the screen */
134
140
overflow-wrap : break-word;
@@ -149,11 +155,7 @@ div.sphinxsidebar {
149
155
border-radius : 5px ;
150
156
line-height : 130% ;
151
157
font-size : smaller;
152
- width : 300px ;
153
- min-width : 200px ;
154
- max-width : 500px ;
155
- resize : horizontal;
156
- overflow : auto;
158
+ transition : width 0.3s ease;
157
159
}
158
160
159
161
div .sphinxsidebar h3 ,
@@ -162,7 +164,7 @@ div.sphinxsidebar h4 {
162
164
}
163
165
164
166
div .sphinxsidebarwrapper {
165
- width : 300 px ;
167
+ width : 217 px ;
166
168
box-sizing : border-box;
167
169
height : 100% ;
168
170
overflow-x : hidden;
@@ -210,6 +212,9 @@ div.sphinxsidebar input[type='text'] {
210
212
width : 12px ;
211
213
border-radius : 0 5px 5px 0 ;
212
214
border-left : none;
215
+ position : absolute;
216
+ right : 0 ;
217
+ transition : background-color 0.3s ease, color 0.3s ease;
213
218
}
214
219
215
220
# sidebarbutton span {
@@ -766,3 +771,13 @@ div.versionremoved .versionmodified {
766
771
display : none;
767
772
}
768
773
}
774
+
775
+ /* Animation */
776
+ @keyframes fadeIn {
777
+ from {
778
+ opacity : 0 ;
779
+ }
780
+ to {
781
+ opacity : 1 ;
782
+ }
783
+ }
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