diff --git a/static/js/carousel.js b/static/js/carousel.js index 043c52e..1bd00c4 100644 --- a/static/js/carousel.js +++ b/static/js/carousel.js @@ -17,16 +17,24 @@ var slideIndex = 1; var slideIndex2 = 1; var slideIndex3 = 1; +function stop_vids() { + for (var video of document.querySelectorAll("video")) { + video.pause(); + } +} + // Next/previous controls function plusSlides(n, className = "mySlides", counter = "slideIndex", dotclass = "dot") { console.log("changing slides"); showSlides(window[counter] += n, className, counter, dotclass); + stop_vids(); } // Thumbnail image controls function currentSlide(n, className = "mySlides", counter = "slideIndex", dotclass = "dot") { showSlides(window[counter] = n, className, counter, dotclass); + stop_vids() } function showSlides(n, className = "mySlides", counter = "slideIndex", dotclass = "dot") {