jQuery 向下滚动弹出 window 页面而不是主 html 页面

jQuery scroll down pop up window page and not the main html page

我们有 html 页面,其中有一个弹出窗口,单击按钮即可打开。 html 页面和弹出窗口都有滚动条。

我希望弹出窗口 window 在单击弹出窗口内的按钮时向下滚动。

我在做: $(window).scrollTop($('#suggestDetails').offset().top);

#suggestDetails 元素位于弹出窗口内,但主 html 页面滚动条在单击按钮时下降,而不是弹出滚动条。

知道如何在弹出窗口中向下滚动 bar/screen 吗?

您需要滚动 popup/modal,而不是 window。

$('#yourmodal-id').scrollTop($('#suggestDetails').offset().top);