【问题标题】:Jquery dialog chrome issue - scroll not visible when opening for second timeJquery对话框chrome问题 - 第二次打开时滚动不可见
【发布时间】:2017-01-05 04:53:22
【问题描述】:

这是我的模态 div 元素:

<div id="modal-window" style="display:none;">
    <iframe id="modal-window-inner-html" frameborder="0"></iframe>
</div>

这是我在 javascript 中定义的 jquery modal:

 $("#modal-window").dialog({
        autoOpen: false,
        modal: true,
        width: 350, 
        height: 800
 });

这是 iframe css:

#modal-window iframe {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    width: 100%;
}

在 iframe 内容中,我通常会放置应该滚动的大 html。我有一个 chrome 问题(其他浏览器工作正常),当我第一次在 chrome 中打开模式时一切都很好(滚动可见),但是当我关闭模式并再次打开第二、第三次等时,滚动不可见但我仍然可以滚动内容。如何强制此滚动可见? 我试着把 overflow-y: auto !important;在 iframe 上,将 maxHeight 放在 jquery modal 上,在关闭时破坏 jquery modal,但没有解决问题。

【问题讨论】:

  • 尝试添加overflow-y: scroll !important
  • 另外,z-index 也可能是这里的一个问题。尝试将 z-index 添加为一个非常高的数字,例如 999,例如
  • 我已经尝试过的第一个建议,它不是解决方案。在哪里放置高 z-index?把它放在 iframe 上没有帮助。
  • iframe 是否需要适合窗口的整个屏幕?如果没有,请尝试添加以像素为单位的固定高度。
  • 以像素为单位的固定高度解决了这个问题。谢谢。你可以把它写成答案。

标签: javascript jquery css google-chrome iframe


【解决方案1】:

给 iFrame 添加一个固定的像素高度应该可以修复它

【讨论】:

  • 将高度从 100% 更改为以像素为单位的固定高度会切断 iframe 内容,因为它具有可变高度,我无法确定内容的长度。
  • 尝试添加最小高度(以像素为单位)和高度为自动
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-03
  • 1970-01-01
  • 2019-01-27
相关资源
最近更新 更多