0

我在页面底部有一个按钮,一旦单击按钮,就会弹出一个显示。但是,页面会自动滚动到顶部,所以我必须手动向下滚动才能看到弹出窗口。我什至添加了一个向下滚动到当前位置的功能,但它仍然无法正常工作。我希望屏幕和弹出窗口都留在底部。

.html 文件

   <button (click)=" goToBottom(); openPopup('Image',300)">CLICK FOR IMAGE</button>

打字稿文件

goToBottom(){
    window.scrollTo(0, document.body.scrollHeight);
  }

 openPopup(winTitle, winWidth) {
      const windowRef = this.window_S.open({
        appendTo: this.ngWinRef,
        title: winTitle,
        content: AComponent,
        width: winWidth,
        top: window.innerHeight / 3+ window.scrollY,
        left: (window.innerWidth - winWidth) / 4
      });
    }
  }
4

0 回答 0