like the bootstrap modal event of hidden.bs.modal
$('.modal-trigger').leanModal({
dismissible: true, // Modal can be dismissed by clicking outside of the modal
opacity: .5, // Opacity of modal background
in_duration: 300, // Transition in duration
out_duration: 200, // Transition out duration
ready: function() { alert('Ready'); }, // Callback for Modal open
complete: function() { alert('Closed'); } // Callback for Modal close
}
);
Reference: http://materializecss.com/modals.html
In my case the complete function is getting called before the modal is shown to the user.
We are using old leanModal() for initialize. it's hard change all code for new materializecss
How can I perform calling an event on callback of a specific modal .
var onModalClose = function() {
alert("Modal closed!");
};
var modal = document.querySelector('.modal');
M.Modal.init(modal,{
onCloseEnd: onModalClose // Callback f眉r Modal schlie脽en.
}
This will work with the Latest Version the other snippets are outdated.
Most helpful comment
In my case the complete function is getting called before the modal is shown to the user.