Skip to content

Commit

Permalink
fix slideshow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Oct 1, 2024
1 parent abcea64 commit dd01e00
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion static/slideshow.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function xhr_get(url, callback_func) {

// from https://stackoverflow.com/a/12646864
function shuffle_content() {
console.debug("shuffling content");
array = Object.keys(content);
for (let i = array.length - 1; i >= 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
Expand Down Expand Up @@ -102,7 +103,8 @@ window.setInterval(function() {
if (next_asset['type'] == 'image') {
img = document.createElement("img");
img.onload = function() {
video.stop();
video.pause();
video.currentTime = 0;
video.style.display = "none";

image.src = this.src;
Expand All @@ -111,6 +113,7 @@ window.setInterval(function() {
img.src = next_asset['url'];
} else if (next_asset['type'] == 'video') {
image.style.display = "none";

video.src = next_asset["url"];
video.style.display = "block";
video.play();
Expand Down

0 comments on commit dd01e00

Please sign in to comment.