我有一个打开材料对话框的按钮。在打开的对话框中,后台页面滚动到顶部。关闭对话框后,页面将滚动回到原始位置。
谁可以停止滚动?
const dialogRef = this.dialog.open(dialogComponent, {
panelClass: config.panelClass,
width: 1100px,
height: 800px,
closeOnNavigation: true,
maxHeight: '95%',
maxWidth: '95%',
data: {
someData...
},
});
我的html
<div class="dialog dialog__content">
<div>
<div *ngIf="title" class="dialog__header">
<h1 mat-dialog-title>{{title | translate}}</h1>
</div>
<div class="dialog__closing">
<button matDialogClose>
<i class="fal fa-times-circle"></i>
</button>
</div>
</div>
<mat-dialog-content>
...some content...
</mat-dialog-content>
<mat-dialog-actions *ngIf="buttons && buttons.length > 0">
<div class="buttons">
<button>...</button>
</div>
</mat-dialog-actions>
</div>
答案 0 :(得分:1)
我在这里找到了解决方法:https://github.com/angular/material2/issues/7390
.cdk-global-scrollblock {
position: initial;
width: initial;
overflow: hidden;
}