最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Two sidenav in a page in Angular Material - Stack Overflow

programmeradmin4浏览0评论

Right now I have 2 sidenavs in a page. As you can see in the picture, sidenav1 is locked open according to $mdMedia(gt-md) and sidenav2 is locked open when $mdMedia(gt-sm).

The problem is that in some point, when sidenav1 is hidden and sidenav2 is visible, and I click the toggle button to show sidenav1, this one is shown behind the sidenav2, as you can see in the image bellow. I change the z-index but it doesn't work. How can I prevent this?

Right now I have 2 sidenavs in a page. As you can see in the picture, sidenav1 is locked open according to $mdMedia(gt-md) and sidenav2 is locked open when $mdMedia(gt-sm).

The problem is that in some point, when sidenav1 is hidden and sidenav2 is visible, and I click the toggle button to show sidenav1, this one is shown behind the sidenav2, as you can see in the image bellow. I change the z-index but it doesn't work. How can I prevent this?

Share Improve this question asked Nov 19, 2015 at 14:41 GolinmarqGolinmarq 1,0164 gold badges16 silver badges28 bronze badges 2
  • Just to be clear, when you click toggle button to show sidenav1, you want to display the layout as you show in the first image? – Shaohao Commented Nov 19, 2015 at 15:09
  • @ShaohaoLin no, it should show like the second image but the sidenav1 over the sidenav2 and not the other way. It should be the main sidenav shown – Golinmarq Commented Nov 19, 2015 at 16:05
Add a ment  | 

1 Answer 1

Reset to default 5

You can have two side bars one right and other left

 <mat-sidenav-container>

    <mat-sidenav #right position="start">
       Start Sidenav.
    </mat-sidenav>

    <mat-sidenav #left position="end">
       End Sidenav.
    </mat-sidenav>

<div>
    <button mat-button (click)="right.open()">right</button>
    <button mat-button (click)="left.open()">left</button>
</div>

</mat-sidenav-container>
发布评论

评论列表(0)

  1. 暂无评论