1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00

Fix navigation on Android Chrome

This commit is contained in:
Unrud 2020-03-23 20:49:08 +01:00
parent 8fb12bbc49
commit ed54787e8c
4 changed files with 27 additions and 9 deletions

View file

@ -0,0 +1,17 @@
window.addEventListener("load", function() {
for (let link of document.querySelectorAll("nav a")) {
link.addEventListener("click", function() {
let fragmentIndex = link.href.indexOf("#");
let anchor = null;
if (fragmentIndex >= 0) {
let fragment = link.href.substring(fragmentIndex + 1, link.href.length);
anchor = document.getElementById(fragment);
}
if (anchor) {
document.documentElement.scrollTop += anchor.getBoundingClientRect().y;
} else {
document.documentElement.scrollTop = 0;
}
});
}
});