Chrome 中的 iframe 滚动事件监听

发布于 2024-12-03 06:02:03 字数 406 浏览 3 评论 0原文

所有,

我有两个图像(SVG),我想在 iframe 中“固定位置”。不幸的是固定位置的CSS属性在这里不起作用,所以我尝试用js来完成这个。

下面是监听 iframe 滚动运动的代码,我用它来移动 iframe 中的图像 (SVG)。不幸的是,这在 Chrome 中不起作用。请任何指导。

window.onload = function () { var f = document.getElementById("iframe_id").contentWindow; frm.onscroll = movef; }

function movef (evt) {
    alert ("hello");
}

All,

I have two images (SVG) which I want to 'fixed position' in an iframe. Unfortunately the CSS property of fixed position does not work here, so am trying to accomplish this with js.

Here is the code which listens to the scroll movement of the iframe which I use to move the images (SVG) in the iframe. Unfortunately, this is not working in Chrome. Any guidance please.

window.onload = function () {
var f = document.getElementById ("iframe_id").contentWindow;
frm.onscroll = movef;
}

function movef (evt) {
    alert ("hello");
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

﹂绝世的画 2024-12-10 06:02:03

chrome 中的文档语言略有不同。
contentWindow 将是 chrome 中的 contentDocument

The document lang differs slightly in chrome.
contentWindow would be contentDocument in chrome

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文