Opening YouTube videos in a lightbox.


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $(document).ready(function(){
  2. $('a[href*="youtube.com/watch"]').click(function() {
  3.  
  4. $.fancybox({
  5. 'padding' : 0,
  6. 'autoScale' : false,
  7. 'transitionIn' : 'none',
  8. 'transitionOut' : 'none',
  9. 'title' : this.title,
  10. 'width' : 680,
  11. 'height' : 495,
  12. 'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
  13. 'type' : 'swf',
  14. 'swf' : {
  15. 'wmode': 'transparent',
  16. 'allowfullscreen': 'true'
  17. }
  18. });
  19.  
  20. return false;
  21. });
  22.  
  23. });

URL: http://www.dropthenerd.com/how-to-show-youtube-videos-in-a-lightbox/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.