我希望能够在不隐藏 md 工具栏左上部分的情况下切换 sidenav,类似于Google 收件箱的工作方式:
(来源:cbsistatic.com)
似乎是切换功能导致了它,因为没有动画,sidenav 显示在 md-toolbar 下方。
那可能吗?
<body layout="column" ng-controller="mainCtrl">
<md-toolbar layout="column" class="md-medium-tall"><span flex="flex"></span>
<div class="md-toolbar-tools">
<md-button class="menu" ng-click="toggleLeft()">
<md-icon md-svg-src="assets/svg/menu.svg"></md-icon>
</md-button>
<div layout="row" flex="flex" class="fill-height">
<div class="md-toolbar-item md-breadcrumb">
<span>Title</span></div>
<span flex="flex"></span>
</div>
</div>
</md-toolbar>
<div layout="row">
<md-sidenav layout="column" md-component-id="left" class="md-whiteframe-z2 md-sidenav-left" >
<md-list>
<md-list-item>
<md-button>Hey</md-button>
</md-list-item>
</md-list>
</md-sidenav>
</div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-animate/angular-animate.min.js"></script>
<script src="bower_components/angular-aria/angular-aria.min.js"></script>
<script src="bower_components/angular-material/angular-material.min.js"></script>
<script src="js/app.js"></script>
和 app.js
var app = angular.module('anApp', ['ngMaterial'])
.controller('mainCtrl', ['$scope', '$mdSidenav', '$mdUtil', function ($scope, $mdSidenav, $mdUtil) {
$scope.toggleLeft = buildToggler('left');
function buildToggler(navID) {
var debounceFn = $mdUtil.debounce(function () {
$mdSidenav(navID)
.toggle()
}, 100);
return debounceFn;
}}]);
谢谢!