Reputation: 39
I'm using materializecss , That is the sideNav initialization, but onOpen property is not working.
$('.button-collapse').sideNav({
menuWidth: 300, // Default is 300
edge: 'left', // Choose the horizontal origin
closeOnClick: true, // Closes side-nav on <a> clicks, useful for Angular/Meteor
draggable: true, // Choose whether you can drag to open on touch screens,
onOpen: function() { alert('Open'); },// A function to be called when sideNav is opened
onClose: function() { alert('Closed'); }// A function to be called when sideNav is closed
});
Upvotes: 2
Views: 561
Reputation: 136
This feature has been added on May 31 in the v0.100.2 version.
https://github.com/Dogfalo/materialize/commit/8a01666817bd6f6f69b7a5b08b1a3f1d1677f1ee
Also, if you do not wish to update to the new version, the show function triggers a click on the side-nav button, and the hide function triggers a click on $('#sidenav-overlay')
Upvotes: 1
Reputation: 3563
This seems like a bug because when I updated to the latest version of Materialize (0.100.2) this problem got solved.
Upvotes: 1
Reputation: 644
This does work but you cant see the alert on a mobile sized screen.
If you use console.log("Open");
instead of alert("Open");
you will be able to see it (but in the console).
Upvotes: -1