Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to trigger MicroModal with ajax call ? #423

Open
HelloTalib opened this issue Mar 9, 2021 · 0 comments
Open

How to trigger MicroModal with ajax call ? #423

HelloTalib opened this issue Mar 9, 2021 · 0 comments

Comments

@HelloTalib
Copy link

HelloTalib commented Mar 9, 2021

in my case this code doesn't work properly, it needs multiple clicks to trigger MicroModal that's I don't want, is there any solution?

$.ajax({
type: "POST",
dataType: "json",
url: my_ajax_url.ajaxurl,
data: {
action: "data_action_callback",
product_id: product_id,
},
success: function (response) {
$("body") .append(response.data).promise().then(function () {
MicroModal.init({
// onShow: modal => console.info(${modal.id} is shown), // [1]
// onClose: modal => console.info(${modal.id} is hidden), // [2]
openTrigger: "data-micromodal-trigger", // [3]
closeTrigger: "data-custom-close", // [4]
disableScroll: true, // [5]
disableFocus: false, // [6]
awaitOpenAnimation: false, // [7]
awaitCloseAnimation: false, // [8]
debugMode: true, // [9]
});
})
},
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant