I have set up a md-sidenav
in my project. I would like the sidenav
to be open by default, while still maintaining an overlay effect on the page and allowing users to close the sidenav
, thus avoiding the use of md-is-locked-open
. Any suggestions on how I can achieve this?
Here is the HTML code snippet:
<md-button class="md-icon-button hamburger" aria-label="More" ng-click="openLeftMenu()" style="height: auto;">
<md-icon md-svg-icon="images/menu.svg"></md-icon>
</md-button>
<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2 menuside" md-component-id="left">
<div class="navheader" layout="row" layout-align="space-between center">
<!--show location-->
<md-button ui-sref="map" ng-click="openLeftMenu()" md-ink-ripple="false" class="yourlocation" layout="row" layout-align="start center" aria-label="Current-location">
<p class="locationtext">{{currentLocation}}</p>
</md-button>
<!--close menu-->
<button class="hambugerclose" ng-click="openLeftMenu()">
<i class="material-icons">clear</i>
</button>
</div>
<!--MOBILE MENU GRID-->
<div layout="row" layout-align="center center" class="jumbowrapper2" layout-wrap>
<div ng-repeat="navitem in navitems" class="navitemwrap" flex="33">
<md-button md-ink-ripple="false" layout="column" layout-align="center center" ui-sref="{{navitem.path}}" href="{{navitem.link}}" ng-click="openLeftMenu()" class="itembutton">
<div class="iconoutline" layout="column" layout-align="center center">
<md-icon class="itemicon" md-svg-src="{{navitem.icon}}"></md-icon>
</div>
<p class="itemtext2" translate>{{navitem.title}}</p>
</md-button>
</div>
</div>
</md-sidenav>
And here is the corresponding JavaScript code:
$scope.openLeftMenu = function() {
$mdSidenav('left').toggle();
};
Thank you for any assistance!