首页 > 解决方案 > 如何修复顶部菜单组件?

问题描述

我需要在滚动页面时修复 topmenu 组件。滚动页面时工具栏组件消失。

怎么做?

html:

<app-toolbar></app-toolbar>
<mat-sidenav-container>
    <mat-sidenav-content fxLayout="column">
        <app-topmenu></app-topmenu>
        <div fxFlex="1 1 auto">
            <router-outlet></router-outlet>
        </div>
        <app-footer ></app-footer>
    </mat-sidenav-content>
</mat-sidenav-container>

CSS:

mat-sidenav-container {
    min-height      : calc(100% - 60px);
    height          : calc(100% - 60px);
    background-color: #eaeaea;
}

mat-sidenav-content {
    min-height: 100%;
    height    : 100%;
}

标签: cssangularangular-materialangular-flex-layout

解决方案


试试这个代码来定位固定的顶部菜单。

app-topmenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%
}

推荐阅读