$.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 to make it work for more than one instance?
It seems the problem is here:
_checkInstance = function() {
if(!$.magnificPopup.instance) {
mfp = new MagnificPopup();
mfp.init();
$.magnificPopup.instance = mfp;
}
}
But when declared this way:
$('.acb-modal').magnificPopup({
type:'inline',
midClick: true,
callbacks: {
close: function() {
$('#opencallback div.timer').hide();
$('#opencallback #callback_form').show();
$('#acb-msg-box').hide();
}
}
});
it works fine.
I think it works on jquery specific but I am not familiar with it.
I can make it work by adding hidden elements for this, but I want to make it clearly.
Yep, I have find solution for me by parsing jquery object :-)
You can directly redeclare callbacks methods by using this
$.magnificPopup.instance.st.callbacks = {
close: function() {
alert('test3')
}
}
before using $.magnificPopup.open
thanks for help)