ngb模态滚动到页面顶部

问题描述 投票:0回答:1

我在Angular 7应用程序中使用ngb模态,并且在打开模态时,我需要执行特定操作时滚动到模态顶部。

例如,模态底部有一个按钮,单击此按钮后,我需要页面滚动到模态顶部,

我尝试使用

window.scrollTop = 0;

document.getElementsByClassName('custom-modal').scrollTop = 0;

document.getElementsByClassName('custom-modal').scrollTo({
  top: 0
})

但是这些解决方案不起作用。

bootstrap-4 bootstrap-modal angular7
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.