21 lines
555 B
JavaScript
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");
|