title: parent.jQuery.fancybox.close(); from within Fancybox only closes Fancybox once
body: <p>I'm trying to close a Fancybox instance from a link within the Fancybox content. I'm using <code>parent.jQuery.fancybox.close();</code> as recommended in <a href="https://stackoverflow.com/questions/2227096/fancybox-iframe-returns-parent-as-undefined-using-wordpress">this question</a>. It works the first time, but thereafter not. Can anyone suggest a fix?  </p>
  
  <p>I'm hiding my content div in the page with this:</p>
  
  <pre><code>#content {
      display: none;
  }
  </code></pre>
  
  <p>And here's the link launching the Fancybox, with that content div, which includes the link to close the Fancybox.</p>
  
  <pre><code>&lt;a href="#" id="launch"&gt;Launch&lt;/a&gt;
  
  &lt;div id="content"&gt;
      &lt;p&gt;Nunc porttitor pellentesque magna a pulvinar. Vestibulum id diam lectus. Praesent vel dictum est.&lt;/p&gt;
  
      &lt;a href="#" id="close"&gt;Close&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And this is my JS. I've tried adding the event hander to the close link on opening the Fancybox, but it didn't help.</p>
  
  <pre><code>$(document).ready(function(){
      $('#launch').fancybox({
          'width': 300,
          'content': $('#content'),
          'onClosed':function () {
              $("#content").hide();
          },
          'onStart':function () {
              $("#content").show();
              $('#close').on('click', function(){
                  //console.log($(this).parent);
                  parent.jQuery.fancybox.close();
              })
          },
          'onCleanup':function () {
              $("#content").unwrap();
          }
      });
  })
  </code></pre>
  
  <p>Thanks guys!</p>