Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide an open drawer in material design lite [duplicate]

I have a set of links inside of a drawer. Just like the navigation example here:

http://www.getmdl.io/components/index.html#layout-section/layout

The only difference is that my links don't cause a page to refresh (it's a single page app built with backbone). How do I close the drawer after clicking a link?

like image 847
Mike McKay Avatar asked Oct 31 '22 22:10

Mike McKay


1 Answers

Looks like there is a .is-visible class on the drawer, and by removing it, the drawer hides. So (using jquery) something like this toggles the drawer:

$(".mdl-layout__drawer").toggleClass("is-visible")

So I need to add that to an event handler for the links, or put it in an onClick attribute.

like image 121
Mike McKay Avatar answered Jan 04 '23 13:01

Mike McKay