@@ -421,25 +421,25 @@ define([
421421 // some elements from https://stackoverflow.com/questions/20791374/jquery-check-if-element-is-visible-in-viewport
422422 function highlightTocItemOnScroll ( cfg , st ) {
423423 if ( cfg . markTocItemOnScroll ) {
424- var scrolling_elt = liveNotebook ? '#site' : window
424+ var scrolling_elt = liveNotebook ? '#site' : window ;
425425 $ ( scrolling_elt ) . scroll ( function ( ) {
426- var headerVisibleHeight = $ ( '#header' ) . is ( ':visible' ) ? $ ( '#header' ) . height ( ) : 0
427- var headerHeight = liveNotebook ? headerVisibleHeight : 0
426+ var headerVisibleHeight = $ ( '#header' ) . is ( ':visible' ) ? $ ( '#header' ) . height ( ) : 0 ;
427+ var headerHeight = liveNotebook ? headerVisibleHeight : 0 ;
428428 var bottom_of_screen = $ ( window ) . scrollTop ( ) + $ ( scrolling_elt ) . height ( ) + headerHeight ;
429429 var top_of_screen = $ ( window ) . scrollTop ( ) + headerHeight ;
430430 //loop over all headers
431431 all_headers . each ( function ( i , h ) {
432- var top_of_element = $ ( h ) . offset ( ) . top ;
432+ var top_of_element = Math . round ( $ ( h ) . offset ( ) . top ) ;
433433
434- if ( ( bottom_of_screen > top_of_element ) && ( top_of_screen < top_of_element ) ) {
434+ if ( ( bottom_of_screen > top_of_element ) && ( top_of_screen <= top_of_element ) ) {
435435 // The element is visible
436- var trg_id = $ ( h ) . attr ( 'data-toc-modified-id' )
436+ var trg_id = $ ( h ) . attr ( 'data-toc-modified-id' ) ;
437437 if ( trg_id !== undefined ) {
438438 var highlighted_item = $ ( '#toc a' ) . filter ( function ( idx , elt ) {
439439 return $ ( elt ) . attr ( 'data-toc-modified-id' ) === trg_id ;
440440 } ) ;
441- $ ( '#toc .highlight_on_scroll' ) . removeClass ( 'highlight_on_scroll' )
442- highlighted_item . parent ( ) . addClass ( 'highlight_on_scroll' )
441+ $ ( '#toc .highlight_on_scroll' ) . removeClass ( 'highlight_on_scroll' ) ;
442+ highlighted_item . parent ( ) . addClass ( 'highlight_on_scroll' ) ;
443443 }
444444 return false ;
445445 } else {
@@ -670,9 +670,6 @@ define([
670670 setNotebookWidth ( cfg ) ;
671671 table_of_contents ( cfg ) ;
672672 $ ( "#toc_button" ) . toggleClass ( 'active' , show ) ;
673- if ( ! $ ( '#data_side_panel' ) . is ( ':hidden' ) ) {
674- $ ( '#btn_datasets' ) . click ( ) ;
675- }
676673 } ;
677674
678675 var show_settings_dialog = function ( cfg , st ) {
0 commit comments