Updated Blog-Post page (#1260)

* Updated Blog-Post page

* Second version of the progress bar

* Updated Progress bar for Safari and Firefox

* Returned the scroll bar in the first version
This commit is contained in:
nastyapash
2024-11-05 13:28:46 +01:00
committed by GitHub
parent 241cf2026f
commit 2f38a71bde
9 changed files with 247 additions and 9 deletions
@@ -146,3 +146,20 @@
});
</script>
{{ end }}
{{ if and (eq .Section "blog") (.IsPage) }}
<script>
document.addEventListener("scroll", () => {
const article = document.getElementById("article");
const progress = document.getElementById("progress");
const articleHeight = article.scrollHeight - window.innerHeight;
const scrollTop = window.scrollY - article.offsetTop;
progress.value = Math.min(
Math.max((scrollTop / articleHeight) * 100, 0),
100
);
});
</script>
{{ end }}