Skip to content

Instantly share code, notes, and snippets.

@maltefiala
Last active March 26, 2016 10:34
Show Gist options
  • Save maltefiala/e40f0e0c28a163e80d7a to your computer and use it in GitHub Desktop.
Save maltefiala/e40f0e0c28a163e80d7a to your computer and use it in GitHub Desktop.
// requires jQuery
$(function clickToActivate() {
$(".videoplaceholder" ).click(function() {
var videourl = $( this ).attr( "videourl" );
$( this ).replaceWith( '<iframe src="' + videourl + '" frameborder="0"></iframe>' );
});
});
// CODE FOR CSS
// .videoplaceholder {
// cursor: pointer;
// }
// HTML EMBED
// <div class="videoplaceholder" videourl=<VIDEO URL>">
// <img src="<IMAGE URL>" />
// </div>
@maltefiala
Copy link
Author

Rewrote it, DRY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment