mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-01 18:18:31 +00:00
Fix navigation on Android Chrome
This commit is contained in:
parent
8fb12bbc49
commit
ed54787e8c
4 changed files with 27 additions and 9 deletions
|
@ -15,7 +15,7 @@ window.addEventListener("load", function() {
|
|||
for (let section of document.querySelectorAll("section")) {
|
||||
let id = section.getAttribute("id");
|
||||
let link = nav.querySelector("a[href=\\#" + id.replace(/\//g, "\\/") + "]");
|
||||
if (link !== null) {
|
||||
if (link) {
|
||||
link = link.parentElement;
|
||||
link.classList.remove("active");
|
||||
sections.push([section, link]);
|
||||
|
@ -43,13 +43,12 @@ window.addEventListener("load", function() {
|
|||
}
|
||||
link = link.parentElement;
|
||||
}
|
||||
if (link === null) {
|
||||
nav.scrollTop = 0;
|
||||
} else {
|
||||
if (link) {
|
||||
let topLink = link.getBoundingClientRect().y;
|
||||
let topNav = nav.getBoundingClientRect().y;
|
||||
let y = nav.scrollTop + topLink - topNav - 10;
|
||||
nav.scrollTo(0, y);
|
||||
nav.scrollTop += topLink - topNav - 10;
|
||||
} else {
|
||||
nav.scrollTop = 0;
|
||||
}
|
||||
}
|
||||
function resizeNav() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue