问题
I want to add a side navigation like this to my side:
https://www.google.com/design/spec/material-design/introduction.html
There should be a menu button and a sidenav opens:
But i cant find this method in polymer
. The only possibility is the paper-drawer-panel
but this is opend all the time...
My working paper-drawer-panel example: https://www.sese7.de/polymer/
Does anybody has an idea how to do this with polymer or maybe with https://customelements.io/
Thanks in advance ;)
回答1:
Try setting the forceNarrow
attribute to true.
Below is the documentation from the paper-drawer-panel api docs: https://elements.polymer-project.org/elements/paper-drawer-panel
forceNarrow
Boolean
default: false
If true, ignore responsiveWidth setting and force the narrow layout.
回答2:
Paper-drawer-panel has a closeDrawer()
-method.
A short example here:
var drawerPanel = Polymer.dom(document).querySelector('#paperDrawerPanel');
if (drawerPanel.narrow) {
drawerPanel.closeDrawer();
}
The example is from "Polymer Starter Kit".
来源:https://stackoverflow.com/questions/33463507/how-to-add-a-side-navigation-in-polymer