Magnific popup html page scroll top problem

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

我正在我的网站上使用magnific popups。当我单击图像时,它会在弹出窗口中调用另一个(第二个)html页面,并且效果很好。

我的问题是,当弹出窗口打开时,我想使用此代码将第二页滚动到顶部:

window.scrollBy(0, 0);

但是它不起作用。它将后退内容滚动到顶部。

我想将第二个html页面滚动到弹出窗口内的顶部。

我该怎么做?

javascript magnific-popup
1个回答
0
投票

这是在主页内管理某些iframe的方法:

document.getElementById("YourInsideItemID").onload = function () { this.contentWindow.scrollBy(0, 0)};
© www.soinside.com 2019 - 2024. All rights reserved.