Skip to content

Commit

Permalink
#1996 tweak slideshow logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Roach committed Mar 20, 2019
1 parent a69fa78 commit 375cf3a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions resources/views/modules/random_media/slide-show.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,16 @@
</div>

<script>
// Reload automatically?
var play = <?= json_encode($start_automatically); ?>;

if (play) {
var timeout = setTimeout(slideShowReload, 6000);
}

function slideShowReload() {
if (play) {
var block = $("#block-<?= $block_id ?>").parent();
clearTimeout(timeout);
block.load(block.data('ajaxUrl') + '&start=' + (play ? '1' : '0'));
}
var block = $("#block-<?= $block_id ?>").parent();
clearTimeout(timeout);
block.load(block.data('ajaxUrl') + '&start=' + (play ? '1' : '0'));

return false;
}
Expand All @@ -84,13 +85,11 @@
$(".wt-icon-media-stop").parent().attr('hidden', true);
$(".wt-icon-media-play").parent().attr('hidden', false);
play = false;
clearTimeout(timeout);
return false;
});

$(".wt-icon-media-next").on('click', function () {
play = true;
return slideShowReload();
});

var timeout = setTimeout(slideShowReload, 6000);
</script>

0 comments on commit 375cf3a

Please sign in to comment.