When I hide a YouTube video, it stops playing. However, this is not the case for Vimeo videos. Is there another way to stop a Vimeo video?
If you use Vimeo's updated API code then you can do it like the following: http://jsfiddle.net/deshg/8CV2S/. You can see the stop button now gives you the alert and then the video is unloaded. Cheers!
Then use the following: $( sibling element ). on("contextmenu", function(e) { return false; }); There is some extra styling involved as well, review the demo.
First, add an ID to your iFrame. Then add this to your javascript close window click function:
var $frame = $('iframe#yourIframeId'); // saves the current iframe source var vidsrc = $frame.attr('src'); // sets the source to nothing, stopping the video $frame.attr('src',''); // sets it back to the correct link so that it reloads immediately on the next window open $frame.attr('src', vidsrc);
I recently needed to pause a Vimeo video that was inside a Bootstrap modal when the modal was closed.
The Vimeo video was embedded in an iframe.
This is what worked for me:
$("#my-bootstrap-modal").on('hidden.bs.modal', function (e) { var div = document.getElementById("my-bootstrap-modal"); var iframe = div.getElementsByTagName("iframe")[0].contentWindow; iframe.postMessage('{"method":"pause"}', '*'); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With