vodkabears / Remodal

No longer actively maintained.
http://vodkabears.github.io/remodal/
MIT License
2.75k stars 771 forks source link

Closing the Video when the modal is close #197

Closed akramgassem closed 8 years ago

akramgassem commented 8 years ago

I have use Remodal to insert a embed Youtube video but when you close the modal, the video still playing. Please any solution to prevent closing video when the modal is closed.

vodkabears commented 8 years ago

Clear content.

ghost commented 8 years ago

How to clear content ? No API functions ? Ty.

mkokay commented 8 years ago

Here is a trash fix for you! Attach this function to your close button and give your div an id name, example divID. function endVideo() { var video = $("#divID iframe").attr("src"); $("#divID iframe").attr("src",""); $("#divID iframe").attr("src",video); }

rubelmiah commented 4 years ago

Best solution. Try this code:

$(document).on('closed', '.remodal', function (e) {
    var src = $(this).find('iframe').attr('src');
    $(this).find('iframe').attr('src', '');
    $(this).find('iframe').attr('src', src);
});