$ .magnificPopup.open () callbacks not working
$.magnificPopup.open({
items: {
src: $('#cabinet-msg')
},
type:'inline',
midClick: true,
callbacks: {
close: function() {
alert('test');
}
}
});
$.magnificPopup.open({
items: {
src: $('#cabinet-msg2')
},
type:'inline',
midClick: true,
callbacks: {
close: function() {
alert('test2');
}
}
});
How can I solve this? I need to create popups with javascript not using default initialization. It works, but only for one instance. How do I make it work for more than one instance?
The problem seems to be here:
_checkInstance = function() {
if(!$.magnificPopup.instance) {
mfp = new MagnificPopup();
mfp.init();
$.magnificPopup.instance = mfp;
}
}
But when declared like this:
$('.acb-modal').magnificPopup({
type:'inline',
midClick: true,
callbacks: {
close: function() {
$('#opencallback div.timer').hide();
$('#opencallback #callback_form').show();
$('#acb-msg-box').hide();
}
}
});
it works great.
I think this works in jQuery, but I am not familiar with it.
I can make it work by adding hidden elements for this, but I want to make it clear.
+3
source to share