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:
parent
8fb12bbc49
commit
ed54787e8c
4 changed files with 27 additions and 9 deletions
17
assets/navigation-scroll-fix.js
Normal file
17
assets/navigation-scroll-fix.js
Normal 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue