【发布时间】:2023-03-11 20:36:02
【问题描述】:
将 Firefox 升级到 17 后,iframe 滚动在我的 Web 应用程序中停止工作。我读过最新的 Firefox (https://wiki.mozilla.org/Gecko:Mouse_Wheel_Scrolling) 中的鼠标滚轮事件发生了一些变化,但我不知道为什么它会阻止我的 iframe 滚动。也许是因为我使用 JavaScript 自动创建了这个 iframe。滚动功能适用于最新版 Chrome 和旧版 Firefox。
jQuery :
var iframe = $(document.createElement("iframe")).attr("src", $(this).attr("href")+"&without_js=1")
.css({"border": "0", "width": "100%", "height": ($(window).height() - 100 - 100)+"px", "overflow":"scroll"})
.attr("id", "zaplanowanie_przegladu_frame").attr("name", "table_frame").hide().appendTo($("body"));
【问题讨论】:
-
尝试删除
overflow:scroll,因为它不应该做任何有用的AFAIK。如果它破坏了新 FF 中的 iframe,则应该报告错误 -
如果这没有帮助 - 问题可能出在 iframe 内部,而不是 iframe 本身。
-
那么您是在 iframe 中创建 iframe?
-
使用您的确切代码(带有静态 URL)在 jsfiddle 中创建 iframe,没有问题。值得指出的是,使用 CSS 向 iframe 添加溢出:滚动(或溢出:任何内容)没有任何作用 - iframe 的滚动由滚动属性控制,而不是 CSS。 w3schools.com/tags/att_iframe_scrolling.asp
标签: javascript html firefox dom