1
1
mirror of https://github.com/srid/ema.git synced 2024-12-04 15:01:40 +03:00

Use scrollIntoView to scroll on anchor links

This commit is contained in:
Sridhar Ratnakumar 2022-02-16 19:21:36 -05:00
parent 89c9f9234c
commit 6cb4269a59
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
cabal-version: 2.4
name: ema
version: 0.7.1.0
version: 0.7.1.1
license: AGPL-3.0-only
copyright: 2021 Sridhar Ratnakumar
maintainer: srid@srid.ca

View File

@ -359,7 +359,10 @@ wsClientShim =
routeVisible = document.location.pathname;
}
if (window.location.hash) {
window.location.hash = window.location.hash;
var el = document.querySelector(window.location.hash);
if (el !== null) {
el.scrollIntoView({ behavior: 'smooth' });
}
}
watchCurrentRoute();
};