website/static/src/js/content.js

18 lines
568 B
JavaScript
Raw Normal View History

require("lite-youtube-embed");
2022-09-02 17:18:40 +01:00
const GLightbox = require("glightbox");
2023-10-15 22:29:40 +01:00
const SCROLL_INDICATOR = document.getElementById("scroll-indicator");
const CONTENT = document.querySelector(".container.content");
2022-09-02 17:18:40 +01:00
window.addEventListener("load", () => {
GLightbox({});
});
2023-10-15 22:29:40 +01:00
window.addEventListener("scroll", () => {
const winScroll =
document.body.scrollTop || document.documentElement.scrollTop;
const height = CONTENT.getBoundingClientRect().height;
const scrolled = Math.min((winScroll / height) * 100, 100);
SCROLL_INDICATOR.style.width = `${scrolled}%`;
});