diff --git a/examples/index.html b/examples/index.html
index db62e4fc725fd7..a0b9ec9ea1f59c 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -103,7 +103,7 @@
if ( validRedirects.has( file ) === true ) {
selectFile( file );
- links[ file ].scrollIntoView( { block: 'center' } );
+ updateLinkScroll();
viewer.src = validRedirects.get( file );
viewer.style.display = 'unset';
@@ -171,6 +171,7 @@
event.preventDefault();
panel.classList.toggle( 'open' );
+ updateLinkScroll();
} );
@@ -385,6 +386,17 @@
}
+ function updateLinkScroll() {
+
+ if ( selected !== null ) {
+
+ const link = links[ selected ];
+ content.scrollTop = link.offsetTop - content.offsetTop - ( content.clientHeight - link.offsetHeight ) / 2;
+
+ }
+
+ }
+