Basic controls css and autoscroll
All checks were successful
Build / build (push) Successful in 6m42s
All checks were successful
Build / build (push) Successful in 6m42s
This commit is contained in:
20
static/js/song-controls.js
Normal file
20
static/js/song-controls.js
Normal file
@ -0,0 +1,20 @@
|
||||
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");
|
Reference in New Issue
Block a user