mirror of
https://github.com/TrezOne/congo-hindi-gujarati.git
synced 2026-07-22 18:40:20 -04:00
fix: update to also obey site settings
This commit is contained in:
+17
-10
@@ -39,17 +39,24 @@ if (document.documentElement.getAttribute("data-auto-appearance") === "true") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function add_to_top_elem() {
|
function add_to_top_elem() {
|
||||||
var body = document.body,
|
var body = document.body;
|
||||||
html = document.documentElement;
|
var html = document.documentElement;
|
||||||
|
|
||||||
const height = Math.max(
|
const height =
|
||||||
body.scrollHeight,
|
Math.max(
|
||||||
body.offsetHeight,
|
body.scrollHeight,
|
||||||
html.clientHeight,
|
body.offsetHeight,
|
||||||
html.scrollHeight,
|
html.clientHeight,
|
||||||
html.offsetHeight
|
html.scrollHeight,
|
||||||
) - 150;
|
html.offsetHeight
|
||||||
document.getElementById("to-top").hidden = height < window.innerHeight;
|
) - 150;
|
||||||
|
|
||||||
|
const elem = document.getElementById("to-top");
|
||||||
|
if (elem === null || elem === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
elem.hidden = height < window.innerHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", (event) => {
|
window.addEventListener("DOMContentLoaded", (event) => {
|
||||||
|
|||||||
@@ -29,10 +29,12 @@
|
|||||||
<div class="relative flex grow flex-col">
|
<div class="relative flex grow flex-col">
|
||||||
<main id="main-content" class="grow">
|
<main id="main-content" class="grow">
|
||||||
{{ block "main" . }}{{ end }}
|
{{ block "main" . }}{{ end }}
|
||||||
|
</main>
|
||||||
|
{{ if .Site.Params.footer.showScrollToTop | default true }}
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute bottom-0 end-0 top-[100vh] w-12"
|
class="pointer-events-none absolute bottom-0 end-0 top-[100vh] w-12"
|
||||||
id="to-top"
|
id="to-top"
|
||||||
hidden
|
hidden="{{ .Site.Params.footer.showScrollToTop | default true -}}"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href="#the-top"
|
href="#the-top"
|
||||||
@@ -43,7 +45,7 @@
|
|||||||
↑
|
↑
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
{{ end }}
|
||||||
{{- partial "footer.html" . -}}
|
{{- partial "footer.html" . -}}
|
||||||
{{ if .Site.Params.enableSearch | default false }}
|
{{ if .Site.Params.enableSearch | default false }}
|
||||||
{{- partial "search.html" . -}}
|
{{- partial "search.html" . -}}
|
||||||
|
|||||||
Reference in New Issue
Block a user