File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed
themes/doc/lib/browser/navigation Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -28,21 +28,19 @@ class Sidebar extends React.Component {
2828 }
2929
3030 componentDidUpdate ( ) {
31- if ( this . props . visibleHeaderId ) {
32- if ( $ ( window ) . width ( ) > 800 ) {
33- setTimeout ( function ( ) {
34- const $sidebar = $ ( '.doc-sidebar' ) ;
35- const $firstItem = $ ( $ ( '.doc-sidebar-list' ) . children ( '.doc-sidebar-list__item--link' ) . get ( 0 ) ) ;
36- const $currentItem = $ ( '.doc-sidebar-list__item--current' ) ;
31+ if ( $ ( window ) . width ( ) > 800 ) {
32+ setTimeout ( function ( ) {
33+ const $sidebar = $ ( '.doc-sidebar' ) ;
34+ const $firstItem = $ ( $ ( '.doc-sidebar-list' ) . children ( '.doc-sidebar-list__item--link' ) . get ( 0 ) ) ;
35+ const $currentItem = $ ( '.doc-sidebar-list__item--current' ) ;
3736
38- if ( $currentItem . length > 0 ) {
39- const offset = $currentItem . position ( ) . top - $firstItem . position ( ) . top ;
40- if ( offset > 100 ) {
41- $sidebar . animate ( { scrollTop : offset } , 800 ) ;
42- }
37+ if ( $currentItem . length > 0 ) {
38+ const offset = $currentItem . position ( ) . top - $firstItem . position ( ) . top ;
39+ if ( offset > 100 ) {
40+ $sidebar . animate ( { scrollTop : offset } , 800 ) ;
4341 }
44- } , 100 ) ;
45- }
42+ }
43+ } , 100 ) ;
4644 }
4745 }
4846
You can’t perform that action at this time.
0 commit comments