Twitter Bootstrap Modal stop Youtube video

后端 未结 21 1676
小蘑菇
小蘑菇 2020-11-27 11:57

I\'m very new to javascript and trying to use Twitter bootstrap to get a good looking website up and running quickly. I know this has something to do with jquery, but I\'m

21条回答
  •  眼角桃花
    2020-11-27 12:16

    A much easier way than all of these answers is just replacing the whole src. This works for all modals and you can adjust iframe class as required.

    $('.modal').on('hidden.bs.modal', function(e) {
        var closestIframe = $(e.currentTarget).find('iframe');
        var rawVideoURL = $("iframe")[0].src;
    
        closestIframe[0].src = "";
        closestIframe[0].src = rawVideoURL;
      });

提交回复
热议问题