Last active
March 28, 2016 19:25
-
-
Save leoherzog/68cc9ae8eb6e37f8e464 to your computer and use it in GitHub Desktop.
A drop-in piece of Javascript that will take an array of YouTube video IDs and embed them on the page
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> | |
// Replace line below with video id(s) | |
// e.g. ["K0FdCdQItDI"]; or ["K0FdCdQItDI","8B3dpnUcMBY"]; | |
// | |
// | |
var ids = ["K0FdCdQItDI"]; | |
// | |
// | |
// Don't edit below | |
if (ids.length == 1) { | |
document.write("<iframe width=\"640px\" height=\"360px\" src=\"https://www.youtube.com/embed/" + ids + "?modestbranding=1&rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>"); | |
document.write("<br />"); | |
} | |
else { | |
for (var i = 0; i < ids.length; i++) { | |
document.write("<iframe width=\"640px\" height=\"360px\" src=\"https://www.youtube.com/embed/" + ids[i] + "?modestbranding=1&rel=0\" frameborder=\"0\" allowfullscreen></iframe>"); | |
document.write("<br /> <br />"); | |
}; | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment