Fancybox onClosed callback not working

I am using fancyBox v2.0.4 ...

Well it should be simple, however it does not work in my case ... I just want to run the callback function when fancybox is closed ...

$('a#stpa_announcement_details_open').fancybox({ 'onCleanup': function() { alert('test') }, 'hideOnContentClick': true }); 

does not work

 $('a#stpa_announcement_details_open').fancybox({ 'onClosed': function() { alert('test') }, 'hideOnContentClick': true }); 

does not work

+6
source share
3 answers

You are using options from older versions, so it will be like -

 $('a#stpa_announcement_details_open').fancybox({ 'beforeClose': function() { alert('test') }, 'closeClick': true }); 

You can find these options at http://fancyapps.com/fancybox/#docs

+17
source
  $('a#stpa_announcement_details_open').fancybox({ 'afterClose': function() { alert('test') } }); 

Hope this works.

+1
source

use before closing or after closing. Find the API documentation on the Callbacks tab here http://fancyapps.com/fancybox/#docs

0
source

Source: https://habr.com/ru/post/908266/


All Articles