leanModal() - complete and ready callbacks are not executed
See original GitHub issueHere is the code to initialize Modal (on element ID):
$('#modal_confirm').leanModal({
dismissible: false,
out_duration: 200,
complete: function() { console.log('closed'); },
ready: function() { console.log('open'); }
});
The modal itself:
<div id="modal_confirm" class="modal">
<div class="modal-content" id="modal_confirm_content"></div>
<div class="modal-footer">
<a id="modal_confirm_action_yes" href="#" class="modal-action modal-close waves-effect waves-green btn green">Yes</a>
<a href="#" class="modal-action modal-close waves-effect waves-red btn red">No</a>
</div>
</div>
The modal is opened using openModal() function, since it also automatically fills down contents and assigns additional callback function to “yes” button - here is the function:
function showConfirmation(confirmText, positiveCallbackFunction) {
$('#modal_confirm_content').html(confirmText);
$('#modal_confirm').openModal();
$('#modal_confirm_action_yes').on('click', function() {
positiveCallbackFunction();
});
}
Generally as it is now the “closed” or “open” texts never appears on console. The version of Materialize used is 0.97.7 pulled from cdnjs.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
Materialize Cssmodal showing $(..)leanmodal is not a function ...
When I try to create a a materialize css moal using the below code , I am getting Error. <script src="~/Scripts/jquery ...
Read more >Dogfalo/materialize - Gitter
leanModal ( { ready: function() { // Callback for Modal open. ... @Dogfalo please fix materializecss.com/dropdown.html it's not working. 2cbb051a.
Read more >Modals - Materialize
Introduction. Use a modal for dialog boxes, confirmation messages, or other content that can be called up. In order for the modal to...
Read more >Modals - Materialize
For example, you can call a custom function to run when a modal is ... onOpenStart, Function, null, Callback function called before modal...
Read more >leanModal - a JQuery modal plugin that works with your CSS
Weaknesses. no gallery, iframe or ajax support; untested in IE6. Examples: Basic | With Close Button.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes currently there are a lot of problems with our modal plugin. Currently using the openModal method does not use any of the options you defined. For a temporary fix you can store your options in a variable and pass that in to both
.leanModal(options)
and.openModal(options)
I’m currently working on rewriting the modal plugin to look similar to our other plugins where you would do things like
.leanModal('open')
instead of calling openModalEven on .99 .modal(‘open’) does not trigger ready or complete (or creates a new modal, replacing the old one, I can’t tell). You have to trigger the button or elements that correspond.