Posted By

dropthenerd on 01/17/11


Tagged

video jquery click Lightbox YouTube modal fancybox


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

virendrakryadav
czehner


Opening YouTube videos in a lightbox.


 / Published in: jQuery
 

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

  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. });

Report this snippet  

You need to login to post a comment.