Last active
August 2, 2025 14:10
-
Star
(113)
You must be signed in to star a gist -
Fork
(20)
You must be signed in to fork a gist
-
-
Save cferdinandi/9044694 to your computer and use it in GitHub Desktop.
Revisions
-
Chris Ferdinandi revised this gist
Jun 6, 2014 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,15 @@ /** * Stop an iframe or HTML5 <video> from playing * @param {Element} element The element that contains the video */ var stopVideo = function ( element ) { var iframe = element.querySelector( 'iframe'); var video = element.querySelector( 'video' ); if ( iframe ) { var iframeSrc = iframe.src; iframe.src = iframeSrc; } if ( video ) { video.pause(); } }; -
Chris Ferdinandi created this gist
Feb 17, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ var stopVideo = function ( element ) { var iframe = element.querySelector( 'iframe'); var video = element.querySelector( 'video' ); if ( iframe !== null ) { var iframeSrc = iframe.src; iframe.src = iframeSrc; } if ( video !== null ) { video.pause(); } };