From 7c8d9dd7380bbe5ab448d7301b64973ae1e9d0be Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 3 Apr 2022 12:29:23 +0100 Subject: auto-scroll, without messing with the history --- resources/index.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/index.html b/resources/index.html index c9d5f9e..deb28a8 100644 --- a/resources/index.html +++ b/resources/index.html @@ -81,8 +81,9 @@ async function play(id) { await vlcCommand(`play/${id}`); - document.querySelector('#vlc-controls').open=true; - document.location.hash='#vlc-controls'; + const controls = document.querySelector('#vlc-controls'); + controls.open=true; + controls.scrollIntoView(true); } const filesOpenAbort = new AbortController(); @@ -112,7 +113,9 @@ async function browseTo(id) { filesOpenAbort.abort(); - document.querySelector('#files').open=true; + const filesElem = document.querySelector('#files'); + filesElem.open=true; + filesElem.scrollIntoView(true); document.querySelector('#file-search').value=''; const fileList = document.querySelector('ul#file-list'); const pathList = document.querySelector('ul#path-list'); @@ -130,7 +133,6 @@ }); }); pathList.replaceChildren(...pathItems); - document.location.hash = '#files'; } async function loadRecent() { -- cgit v1.2.3