JQuery 'mmenu' callback event

Using the jQuery mmenu plugin , I need to call the JavaScript function either after closing the menu, or at the same time. In the documentation I do not see any suggestions for closing the entire menu, but only for closePanel . I need to insert one more (normal) in the close function of mmenu in order to hide the lightbox effect on the page.

<script type="text/javascript"> $(document).ready(function() { $("#menu").mmenu({ "extensions": [ "theme-white" ], "offCanvas": { "zposition": "front" }, "slidingSubmenus": false }); $("#menu").show(); }); </script> <script type="text/javascript"> function lightbox(){ (function($) { // some stuff })(jQuery);} </script> 

Is there a way to link another function after the plugin has been closed or better when the action of closing the entire menu?

+5
source share
2 answers

I had the exact same question today, and after some messing around, this works for me. Bind to open / closed events, for example:

 $('#mmenu_id').data('mmenu').bind('opened', function () { console.log('opened'); }); $('#mmenu_id').data('mmenu').bind('closed', function () { console.log('closed'); }); 
+6
source

you can try binding to closing event

 $('#mmenu').on('closing.mm', function() { // do something }); 

There is also a private event, so you can use it, ever suitable

 $('#mmenu').on('closed.mm', function() { // do something }); 
+3
source

All Articles