mixtape/static/js/song-controls.js
Emil Miler 09a4b138d1
All checks were successful
Build / build (push) Successful in 6m42s
Basic controls css and autoscroll
2024-02-16 15:59:15 +01:00

21 lines
555 B
JavaScript

const controls = document.querySelector(".controls");
const song = document.querySelector("iframe.song").contentWindow;
var scroll;
function pageScroll() {
song.scrollBy(0, 1);
scroll = setTimeout(pageScroll, 80);
}
document.querySelector("#autoscroll").addEventListener("click", function() {
if (this.classList.contains("active")) {
clearTimeout(scroll);
} else {
pageScroll();
}
this.classList.toggle("active");
});
// Display the controls on JS-enabled browsers
window.addEventListener("load", () => controls.classList.remove = "hidden");