Skip to content

Instantly share code, notes, and snippets.

@alekskorovin
Created October 17, 2013 14:36
Show Gist options
  • Select an option

  • Save alekskorovin/7026103 to your computer and use it in GitHub Desktop.

Select an option

Save alekskorovin/7026103 to your computer and use it in GitHub Desktop.
Reset a Video players - iframes from YouTube or Vimeo, etc.
// Reset a Video players - iframes from YouTube or Vimeo, etc.
var resetIframeVideoPlayer = function () {
var $videoPlayer = $(this), videoIframeSrc;
// Store the src of iframe with video
videoIframeSrc = $player.attr('src');
// Clear src attribute from an iframe
$videoPlayer.attr('src', '');
// Reassign src attribute
$videoPlayer.attr('src', videoIframeSrc);
}
// Found each of iframes with videos
$.each($('iframe.embed-video'), resetIframeVideoPlayer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment