Materialize: How to listen event of modal dismiss?

Created on 13 Jun 2015  路  5Comments  路  Source: Dogfalo/materialize

like the bootstrap modal event of hidden.bs.modal

Most helpful comment

In my case the complete function is getting called before the modal is shown to the user.

All 5 comments

$('.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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artur99 picture artur99  路  3Comments

cope picture cope  路  3Comments

samybob1 picture samybob1  路  3Comments

ReiiYuki picture ReiiYuki  路  3Comments

heshamelmasry77 picture heshamelmasry77  路  3Comments