Last active
December 25, 2015 00:49
-
-
Save bloqhead/6890507 to your computer and use it in GitHub Desktop.
How to pause all Vimeo videos. Source: http://base42.nl/easiest-way-to-pause-all-vimeo-videos-on-your-site/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(function() { | |
// Vimeo pauser | |
function pauseVimeo() { | |
$('iframe[src*="vimeo.com"]').each( function (iterator, object) { | |
var url = $(object).attr('src').split('?')[0]; | |
object.contentWindow.postMessage(JSON.stringify({ method:"pause" }), url); | |
}); | |
} | |
// Attach it to a button | |
$('#pause').on( 'click', pauseVimeo ); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment