Need help with my close link in fancybox modal window to close it
I want to provide a link to close the fancybox pop-up window.
Here is what I have for code, which does not w开发者_StackOverflow中文版ork, 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">« 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'
});
If you simply want to close the box by clicking on #close-button
, this should be sufficient
$('#close-button').click(function(){
$.fancybox.close();
});
Isin't it supposed to be like this:
$(document).ready(function() {
$('#close-button').click(function(){
$.fancybox.close();
});
});
Just call $.fancybox.close(); like this Close this window';
Problem solved. No need to use a jquery selector and add more overhead.
The below should do the job.
$(function() {
$('#close-button').click(function(event) {
$.fancybox.close(true);
});
});
精彩评论