File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
_assetsApi/docfx-tmpl/src/styles Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -420,10 +420,19 @@ $(function () {
420420 // Scroll to active item
421421 var top = 0 ;
422422 $ ( '#toc a.active' ) . parents ( 'li' ) . each ( function ( i , e ) {
423- $ ( e ) . addClass ( active ) . addClass ( expanded ) ;
424- $ ( e ) . children ( 'a' ) . addClass ( active ) ;
425- top += $ ( e ) . position ( ) . top ;
426- } )
423+ $ ( e ) . addClass ( active ) . addClass ( expanded ) ;
424+ $ ( e ) . children ( 'a' ) . addClass ( active ) ;
425+ var selectedChild = $ ( e ) . children ( 'ul' ) . children ( 'li.active.in' ) ;
426+ var childTop = 0 ;
427+ if ( selectedChild . length ) {
428+ childTop = selectedChild . position ( ) . top ;
429+ if ( selectedChild . offset ( ) . top - $ ( e ) . position ( ) . top > $ ( '.sidetoc' ) . height ( ) ) {
430+ top += childTop ;
431+ }
432+ }
433+
434+ top += $ ( e ) . position ( ) . top ;
435+ } )
427436 $ ( '.sidetoc' ) . scrollTop ( top - 50 ) ;
428437
429438 if ( $ ( 'footer' ) . is ( ':visible' ) ) {
You can’t perform that action at this time.
0 commit comments