File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ <h1><a href="https://threejs.org">three.js</a></h1>
103103 if ( validRedirects . has ( file ) === true ) {
104104
105105 selectFile ( file ) ;
106- links [ file ] . scrollIntoView ( { block : 'center' } ) ;
106+ updateLinkScroll ( ) ;
107107 viewer . src = validRedirects . get ( file ) ;
108108 viewer . style . display = 'unset' ;
109109
@@ -171,6 +171,7 @@ <h1><a href="https://threejs.org">three.js</a></h1>
171171
172172 event . preventDefault ( ) ;
173173 panel . classList . toggle ( 'open' ) ;
174+ updateLinkScroll ( ) ;
174175
175176 } ) ;
176177
@@ -385,6 +386,17 @@ <h1><a href="https://threejs.org">three.js</a></h1>
385386
386387 }
387388
389+ function updateLinkScroll ( ) {
390+
391+ if ( selected !== null ) {
392+
393+ const link = links [ selected ] ;
394+ content . scrollTop = link . offsetTop - content . offsetTop - ( content . clientHeight - link . offsetHeight ) / 2 ;
395+
396+ }
397+
398+ }
399+
388400 </ script >
389401 < template id ="PlaceholderHTML ">
390402 <!DOCTYPE html>
You can’t perform that action at this time.
0 commit comments