【问题标题】:How to fixed the topmenu component?如何修复顶部菜单组件?
【发布时间】:2021-01-06 21:39:10
【问题描述】:

我需要在滚动页面时修复顶部菜单组件。滚动页面时工具栏组件消失。

怎么做?

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%;
}

【问题讨论】:

    标签: css angular angular-material angular-flex-layout


    【解决方案1】:

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

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

    【讨论】:

    • 但这会关闭工具栏组件。
    • 您可以根据需要调整位置,或者您可以通过 stackbliz 向我展示您的代码演示吗?所以我可以给你正确的解决方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多