mirror of
https://github.com/TrezOne/congo-hindi-gujarati.git
synced 2026-07-20 18:01:36 -04:00
feat: add js to check height and decide if to top is required
This commit is contained in:
@@ -38,7 +38,22 @@ if (document.documentElement.getAttribute("data-auto-appearance") === "true") {
|
||||
});
|
||||
}
|
||||
|
||||
function add_to_top_elem() {
|
||||
var body = document.body,
|
||||
html = document.documentElement;
|
||||
|
||||
const height = Math.max(
|
||||
body.scrollHeight,
|
||||
body.offsetHeight,
|
||||
html.clientHeight,
|
||||
html.scrollHeight,
|
||||
html.offsetHeight
|
||||
) - 150;
|
||||
document.getElementById("to-top").hidden = height < window.innerHeight;
|
||||
}
|
||||
|
||||
window.addEventListener("DOMContentLoaded", (event) => {
|
||||
add_to_top_elem();
|
||||
var switchers = document.querySelectorAll("[id^='appearance-switcher']");
|
||||
switchers.forEach((switcher) => {
|
||||
switcher.addEventListener("click", () => {
|
||||
|
||||
Reference in New Issue
Block a user