Modal does not play

1

I have an iframe when I closed it, it was still playing in the background, I removed the attribute src and it no longer plays, but when I open the modal again, it does not open the iframe.

This is the code:

$(document).ready(function()
{
    $("#myModal").modal('hiden');
    var url = $("#cartoonVideo").attr('src');    

    $("#myModal").on('hide.bs.modal', function()
    {
        $("#cartoonVideo").attr('src', '');      
    });

    $("#myModal").on('show.bs.modal.m', function()
    {
        $("#cartoonVideo").attr('src', url);
    });
       $(".modal").click(function(){
        $('#cartoonVideo').removeAttr('src');

    });
});
    
asked by anfeheda 03.04.2017 в 15:24
source

1 answer

0

At first glance the problem seems to be that you have made a mistake in the name of the event show.bs.modal.m , which according to the documentation is show.bs.modal .

Try to do it like this:

$(document).ready(function() {
  $("#myModal").modal('hiden');
  var url = $("#cartoonVideo").attr('src');    

  $("#myModal").on('hide.bs.modal', function() {
    $("#cartoonVideo").attr('src', '');
  });

  // AQUI - Nombre correcto del evento
  $("#myModal").on('show.bs.modal', function() {
    $("#cartoonVideo").attr('src', url);
  });
  
  $(".modal").click(function(){
    $('#cartoonVideo').removeAttr('src');
  });
});
    
answered by 03.04.2017 / 15:58
source