@@ -166,7 +166,7 @@ var make_link = function(h, num_lbl) {
166
166
}
167
167
168
168
function setNotebookWidth ( cfg , st ) {
169
- //cfg.widenNotebook = false ;
169
+ //cfg.widenNotebook = true ;
170
170
if ( cfg . sideBar ) {
171
171
if ( $ ( '#toc-wrapper' ) . is ( ':visible' ) ) {
172
172
$ ( '#notebook-container' ) . css ( 'margin-left' , $ ( '#toc-wrapper' ) . width ( ) + 30 )
@@ -176,19 +176,28 @@ var make_link = function(h, num_lbl) {
176
176
$ ( '#notebook-container' ) . css ( 'margin-left' , 30 ) ;
177
177
$ ( '#notebook-container' ) . css ( 'width' , $ ( '#notebook' ) . width ( ) - 30 ) ;
178
178
} else { // original width
179
- $ ( "#notebook-container" ) . css ( { 'width' :"82%" , 'margin-left' : 'auto '} )
179
+ $ ( "#notebook-container" ) . css ( { 'width' :' '} )
180
180
}
181
181
}
182
182
} else {
183
183
if ( cfg . widenNotebook ) {
184
184
$ ( '#notebook-container' ) . css ( 'margin-left' , 30 ) ;
185
185
$ ( '#notebook-container' ) . css ( 'width' , $ ( '#notebook' ) . width ( ) - 30 ) ;
186
186
} else { // original width
187
- $ ( "#notebook-container" ) . css ( { 'width' :"82%" , 'margin-left' : 'auto '} )
187
+ $ ( "#notebook-container" ) . css ( { 'width' :' '} )
188
188
}
189
189
}
190
190
}
191
191
192
+ function setSideBarHeight ( cfg , st ) {
193
+ if ( cfg . sideBar ) {
194
+ var headerVisibleHeight = $ ( '#header' ) . is ( ':visible' ) ? $ ( '#header' ) . height ( ) : 0
195
+ $ ( '#toc-wrapper' ) . css ( 'top' , liveNotebook ? headerVisibleHeight : 0 )
196
+ $ ( '#toc-wrapper' ) . css ( 'height' , $ ( '#site' ) . height ( ) ) ;
197
+ $ ( '#toc' ) . css ( 'height' , $ ( '#toc-wrapper' ) . height ( ) - $ ( '#toc-header' ) . height ( ) )
198
+ }
199
+ }
200
+
192
201
var create_toc_div = function ( cfg , st ) {
193
202
var toc_wrapper = $ ( '<div id="toc-wrapper"/>' )
194
203
. append (
@@ -281,21 +290,8 @@ var make_link = function(h, num_lbl) {
281
290
// On header/menu/toolbar resize, resize the toc itself
282
291
// (if displayed as a sidebar)
283
292
if ( liveNotebook ) {
284
- $ ( [ Jupyter . events ] ) . on ( "resize-header.Page" , function ( ) {
285
- if ( cfg . sideBar ) {
286
- $ ( '#toc-wrapper' ) . css ( 'top' , liveNotebook ? $ ( '#header' ) . height ( ) : 0 )
287
- $ ( '#toc-wrapper' ) . css ( 'height' , $ ( '#site' ) . height ( ) ) ;
288
- $ ( '#toc' ) . css ( 'height' , $ ( '#toc-wrapper' ) . height ( ) - $ ( '#toc-header' ) . height ( ) )
289
- }
290
- } ) ;
291
- $ ( [ Jupyter . events ] ) . on ( "toggle-all-headers" , function ( ) {
292
- if ( cfg . sideBar ) {
293
- var headerVisibleHeight = $ ( '#header' ) . is ( ':visible' ) ? $ ( '#header' ) . height ( ) : 0
294
- $ ( '#toc-wrapper' ) . css ( 'top' , liveNotebook ? headerVisibleHeight : 0 )
295
- $ ( '#toc-wrapper' ) . css ( 'height' , $ ( '#site' ) . height ( ) ) ;
296
- $ ( '#toc' ) . css ( 'height' , $ ( '#toc-wrapper' ) . height ( ) - $ ( '#toc-header' ) . height ( ) )
297
- }
298
- } ) ;
293
+ $ ( [ Jupyter . events ] ) . on ( "resize-header.Page" , function ( ) { setSideBarHeight ( cfg , st ) ; } ) ;
294
+ $ ( [ Jupyter . events ] ) . on ( "toggle-all-headers" , function ( ) { setSideBarHeight ( cfg , st ) ; } ) ;
299
295
}
300
296
301
297
// enable dragging and save position on stop moving
@@ -636,6 +632,7 @@ var table_of_contents = function (cfg,st) {
636
632
$ ( window ) . resize ( function ( ) {
637
633
$ ( '#toc' ) . css ( { maxHeight : $ ( window ) . height ( ) - 30 } ) ;
638
634
$ ( '#toc-wrapper' ) . css ( { maxHeight : $ ( window ) . height ( ) - 10 } ) ;
635
+ setSideBarHeight ( cfg , st ) ,
639
636
setNotebookWidth ( cfg , st ) ;
640
637
} ) ;
641
638
0 commit comments