FancyBox 2.0 event after closing

I have a fancybox script like this

$.fancybox.open({ href : '<?= site_url('sell_split/popup_qty/') ?>'+url_param, type : 'ajax', afterShow: popup_focus_qty, afterClose: console.log('test') }); 

As you can see, there is an afterClose event. But it seems that when I try to execute this script, the afterClose event occurs first and then the GET process.

enter image description here

This is not what I want. What I want to do is the afterClose event occurs if the visitor closes the FancyBox Window.

Is this a bug from the FancyBox plugin or is the code incorrect?

+6
source share
1 answer

I myself found the answer, he had to write like this

 $.fancybox.open({ href : '<?= site_url('sell_split/popup_qty/') ?>'+url_param, type : 'ajax', afterShow: popup_focus_qty, afterClose: function(){ console.log('test') } }); 
+9
source

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


All Articles