Stop video playing when Bootstrap modal is closed

If you want add a video to a Bootstrap Modal and either dismiss or close the modal while the video is playing the video will keep on playing when you open again. So you can adjust this behaviour by adding in some JavaScript that acts to stop the video if either the modal window is clicked to close or the background is clicked to dismiss the modal.
Add below JavaScript code in your files
<script>
jQuery('#keredariModal').on('hidden.bs.modal', function (e) {
  // do something...
  jQuery('#keredariModal video').attr("src", jQuery("#keredariModal  video").attr("src"));
});
</script> 
 
Note: Please replace your Model ID

Comments

  1. So it's possible to regulate the routines with the addition of using JavaScript the fact that behaviors to cease any video tutorial whenever also any modal eye port is certainly clicked Redirect Http to Https that will shut down or simply the background is certainly clicked that will discount any modal.

    ReplyDelete

Post a Comment

Popular posts from this blog

Creating Protected routes in ReactJS

Add and use wow.js into WordPress theme