Skip to content

Instantly share code, notes, and snippets.

@barbwiredmedia
Last active December 6, 2016 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barbwiredmedia/f964e6a65333c53f6eea20ce6dbe2c2c to your computer and use it in GitHub Desktop.
Save barbwiredmedia/f964e6a65333c53f6eea20ce6dbe2c2c to your computer and use it in GitHub Desktop.
Magnific Popup uses the watch URL format for its popup. By default it does not accept URL parameters I.E. Do not show related videos, Autoplay and Youtube branding -- ?rel=0&autoplay=1&showinfo=0 Adding the JS fixes this. Solution credit:Josue @ http://www.kriesi.at/support/topic/youtube-video-not-working-in-ligthbox/#post-288867
<script>
/*Substitute your id in src*/
jQuery(window).load(function(){
jQuery('a[href*="youtube.com/watch"]').magnificPopup({
type: 'iframe',
iframe: {
patterns: {
youtube: {
index: 'youtube.com',
id: 'v=',
src: '//www.youtube.com/embed/%id%?rel=0&autoplay=1&showinfo=0'
}
}
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment