views:

87

answers:

2

I want to provide a link to close the fancybox pop-up window.

Here is what I have for code, which does not work, but gives you an idea of what I am accomplishing:

$(document).ready(function() {
    $('#close-button').click(function(){
      close.click($.fancybox.close);
    });
  });

<p><a href="#" title="Close" id="close-button">&laquo; close</a></p>

I am including the fancybox and appropriate jQuery files.

Any help is appreciated.

Fix is:

adding 'type': 'iframe' to it

$(".pop-out").fancybox({
  'titlePosition' : 'outside',
  'transitionIn'      : 'fade',
  'transitionOut' : 'none',
  'type'          : 'iframe'
});
+1  A: 

Isin't it supposed to be like this:

$(document).ready(function() {
  $('#close-button').click(function(){
    $.fancybox.close();
  });
});
Mark
no luck. tried w/ $.fn.fancybox.close() as well.
Brad
turned out I needed to set the type to iframe for this to work, had type set to nothing.
Brad
+1  A: 

If you simply want to close the box by clicking on #close-button, this should be sufficient

$('#close-button').click(function(){
  $.fancybox.close();
});
Simen Echholt