【问题标题】:Angular 5 Material - Sticky Div / component inside DialogAngular 5 Material - 对话框内的粘性 Div / 组件
【发布时间】:2019-01-01 13:15:01
【问题描述】:

这是我的材质对话框。

<h1 mat-dialog-title>Title</h1>

<mat-dialog-content>

  <app-container> </app-container>

</mat-dialog-content>

在 app-container 组件模板中还有 3 个其他组件。

<app-container1> </app-container1>
<app-container2 class="sticky"> </app-container2>
<app-container3> </app-container3> 
<!-- app-container 3 contains a list of items iterated over *ngFor -->

三个容器位于一个可滚动的 MatDialog 中。我希望 app-container2 保持粘性或固定在其位置,这样当您在对话框中滚动时,始终可以看到 app-container2。

.sticky {
   position: fixed !important; //position: sticky !important;
}

我不知道我做错了什么。请帮帮我。

【问题讨论】:

标签: angular css angular5 angular-material-5


【解决方案1】:

对话框面板及其内容的样式需要属于使用对话框配置的“panelClass”选项指定的类:

.dialogPanel .sticky {
    position: fixed;
}

this.dialog.open(MyDialog, { panelClass: 'dialogPanel' });

【讨论】:

    猜你喜欢
    • 2020-06-24
    • 2017-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多