title: Close fancybox popup when youtube video finish
body: <p>i did a popup with youtube video at page load.</p>
  
  <p>I need that the popup close when the video finish...is it possible to integrate this script?</p>
  
  <p>This is the code:</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="jquery.fancybox-1.3.1.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="jquery.fancybox-1.3.1.css" media="screen"  /&gt;
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
  
          $("#yt").click(function() {
              $.fancybox({
                      'padding'        : 0,
                      'autoScale'      : false,
                      'transitionIn'   : 'none',
                      'transitionOut'  : 'none',
                      'title'          : this.title,
                      'width'          : 880,
                      'height'         : 595,
                      'href'           : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
                      'type'           : 'swf',
                      'swf'            : {
                          'wmode'              : 'transparent',
                          'allowfullscreen'    : 'true'
                      }
                  });
              return false;
          });
      });
      $('#foo').bind('click', function() {
            alert($(this).text());
          });
          $('#foo').trigger('click');
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body onload='$("#yt").trigger("click");'&gt;
  
      &lt;h1&gt;fancybox example&lt;/h1&gt;
      &lt;p&gt;&lt;a id="yt" title="" href="https://www.youtube.com/watch? v=y0vh14W4iTM&amp;amp;fs=1&amp;amp;autoplay=1"&gt;&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  
  <p>I report this discussion.</p>
  
  <p><a href="https://stackoverflow.com/questions/14880803/fancybox-and-youtube-api-events/23044787?noredirect=1#comment35210006_23044787">FancyBox and Youtube API events</a></p>
  
  <p>I've not practice with javascript someone can help me?</p>