【问题标题】:Iframe with pdf black flickering(blinking)带有pdf黑色闪烁的iframe(闪烁)
【发布时间】:2011-11-04 06:02:55
【问题描述】:

我的页面上有一个带有 pdf 的 iframe,并尝试在滚动 iframe 时禁用主窗口的滚动。这是它的代码:

$('iframe')
    .mouseover(function () {
        var html = $('html');
        html.data('previous-overflow', html.css('overflow'));
        html.css('overflow', 'hidden');
        html.css('margin-right', '17px');
    })
    .mouseout(function () {
        // un-lock scroll position
        var html = $('html');
        html.css('overflow', html.data('previous-overflow'));
        html.css('margin-right', '0px');
    });

但此类 css 更改会导致 iframe 内容闪烁(使用 Chrome 13)。 我该如何解决这个闪烁问题?

【问题讨论】:

  • 你有运行代码的示例页面吗?
  • 是的,在这里托管:dima.staticloud.com 我使用没有任何 pdf 插件的 chrome
  • 您是说如果禁用 css 更改不会发生闪烁?这似乎是 chrome 的 PDF 查看器的问题
  • 完全正确:禁用 css 更改和闪烁停止。我在 chrome 上的 dev-branch (ver. 15) 上尝试了同样的方法,一切正常,所以我认为你是对的,这是第 13 版的错误。
  • 它在 Chrome16 中运行良好,但在 Firefox9 中失败(未显示 pdf,但保存为文件)

标签: jquery css pdf iframe scroll


【解决方案1】:

如果您想在所有浏览器和操作系统上工作,唯一的方法是使用自定义滚动条,例如 Tiny scrollbar 或者您可以在此滚动条列表http://www.net-kit.com/jquery-custom-scrollbar-plugins/ 中进行抢劫。

【讨论】:

    猜你喜欢
    • 2015-05-01
    • 1970-01-01
    • 2012-02-05
    • 1970-01-01
    • 1970-01-01
    • 2012-06-18
    • 1970-01-01
    • 1970-01-01
    • 2014-03-24
    相关资源
    最近更新 更多