Reputation: 1031
I am using fancy box 1.3 with ajax option. I want to add close button to popup which will act same as close image on the popup corner so written on click event of close button -
$.fn.fancybox.close()
tried with
`jQuery.fn.fancybox.close()`
none seem to work. I am getting jQuery.fn.fancybox.close() not function error message. here is code.
$('#cancel-filters-btn').click(function(){
jQuery.fn.fancybox.close();
});
Upvotes: 1
Views: 2220
Reputation: 1317
You tried to call the function on no object. Call it on your elements (by selector):
$('#cancel-filters-btn').click(function(){
$.fancybox.close();
});
Upvotes: 1
Reputation: 74738
try delegating the event:
$(document).on('click', '#cancel-filters-btn', function(){
$.fancybox.close();
});
Upvotes: 2
Reputation: 5461
You may try like this
$('#cancel-filters-btn').click(function(){
$.fancybox.close();
});
Upvotes: 2
Reputation: 6147
please check this one
$('#cancel-filters-btn').click(function(){
$.fancybox.close();
});
Upvotes: 1