2017-08-28 3 views
1

私はモーダルブーストにビデオを持っています。私はそれを行う方法を理解することができない、ビデオの最後にモーダルを閉じる。ビデオの終わりにモーダルを閉じます

<section class="video"> 
    <button type="button" class="btn btn-lg video__btnModal" data-toggle="modal" data-target="#video__btnModal">VIDEO</button> 
    <div id="video__btnModal" tabindex="-1" class="modal fade" role="dialog"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
     <div class="modal-body"> 
      <video controls id="video1" style="width: 100%; height: auto; margin:0 auto; frameborder:0;"> 
      <source src="./assets/video/video.mp4" type="video/mp4"> 
      <source src="./assets/video/video.mov" type="video/mov"> 
      </video> 
     </div> 
     </div> 
    </div> 
    </div> 
</section> 

答えて

1

JS

<script type='text/javascript'> 
    document.getElementById('video1').addEventListener('ended',myHandler,false); 
    function myHandler(e) { 
     // What you want to do after the event 
    } 
</script> 

のjQuery

$("#video1").on("ended", function() { 
    //TO DO: Your code goes here... 
     alert("Video Finished"); 
}); 

あなたは

$('#video__btnModal').modal('hide');// hides the modal 

$('#video__btnModal').modal('toggle');// toggles between hide and show 
+0

は非常に難しありがとう呼び出す必要がモーダル非表示にしますあなたの助けにh – DenisMasot

関連する問題