I
I
Igor Roschak2015-08-31 14:36:57
JavaScript
Igor Roschak, 2015-08-31 14:36:57

How to stop video after closing Bootstrap modal window?

Hello, please tell me how to stop the video after closing the Bootstrap modal window.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Zachinalov, 2015-08-31
@iRoschak

$('.youmodal').on('hide.bs.modal', function () {
  var video = document.getElementsByTagName('video');
  for (var i = 0; i < video.length; i++) {
    video[i].pause();
  }
  });

this will pause all the videos, if there is only one, then you can write video[0].pause() or video[0].stop() instead of the loop

R
Rikcon, 2015-08-31
@Rikcon

subscribe to the modal closing event and stop the video that was in this modal, what's the problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question