I'm firing the plugin on click.
$('#activate_mmenu').on('click', function(){
$('#menu').mmenu();
});
is there a way to bind another function after the plugin has been activated?
something like this:
$('#activate_mmenu').on('click', function(){
$('#menu').mmenu(function(){
alert('plugin is activated!');
});
});
Mmenu triggers it's own events
$("#nav")
.mmenu()
.trigger( "mmenu-created" )
);
more information is available here: http://mmenu.frebsite.nl/events.php
Edit: Had removed the wrong part of the code. You can trigger an event right after the mmenu initialisation.
$('#activate_mmenu').on('click', function(){
$("#menu")
.mmenu()
.on('init', function(){
console.log('init');
})
.trigger( "init" );
});
The documentation doesn't say a ton about custom events, but I got this to work. Then trigger it. As a result, you can simulate callbacks on initialization.
At first I created the custom event and bound it to the .mm namespace as recommended in the docs, but that doesn't appear to be necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With