简体   繁体   English

iFrame 和溢出问题:隐藏在 IE11 中

[英]Issue with iFrame and overflow:hidden in IE11

I am running into an issue that apparently only exists in IE 11. This is for an intranet page.我遇到了一个显然只存在于 IE 11 中的问题。这是针对 Intranet 页面的。 The relevant code is below.相关代码如下。

<!DOCTYPE HTML>
<html>
    <head>
        <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
        <meta http-equiv="X-UA-Compatible" content="IE=11" />
    <title>Result</title>
    </head>
    <body>
        <div id="chatcontent">
            <iframe class="noscrolling" src="intranetsharepoint" target="_blank" scrolling="no"></iframe>           
        </div>
    </body>
</html>

stylesheet.css样式表.css

body {
    background-color: #F0F8FF;
}
#chatcontent{
    width:20%;
    margin: auto;
}
.noscrolling{
    height: 50px;
    width: 120px;
    overflow: hidden;
    border: 0;
    overflow-x: hidden;
    overflow-y: hidden;
}
iframe{
    overflow-x: hidden;
}

I have been banging my head against the wall trying to figure out why, in all of the other browsers, the scrollbars disable themselves, but in IE 11 they refuse to sod off in the iFrame element.我一直在用头撞墙,试图弄清楚为什么在所有其他浏览器中,滚动条会自行禁用,但在 IE 11 中,它们拒绝在iFrame元素中消失。 It works just fine when putting overflow: hidden in the body, can't scroll anywhere, only seems to not work in iFrame .当把overflow: hidden放在 body 中时它工作得很好,不能滚动到任何地方,只是在iFrame似乎不起作用。 I have tried every variation of overflow: hidden , scrolling=no, forcing html 4 via !DOCTYPE declaration, compatibility with older versions of IE, and nothing seems to be working.我尝试了所有overflow: hidden变体overflow: hidden 、滚动=否、通过 !DOCTYPE 声明强制使用 html 4、与旧版本的 IE 兼容,但似乎没有任何效果。 Any advice at this point would be a godsend.在这一点上的任何建议都是天赐之物。 I saw a snippet of code that would have made an iFrame out of JS, but I don't understand enough of the language to put it together with what I already have.我看到了一段可以用 JS 制作iFrame的代码片段,但我对这种语言的了解不够,无法将它与我已有的东西放在一起。 Any help would be greatly appreciated.任何帮助将不胜感激。 It works as intended in Chrome and FF.它在 Chrome 和 FF 中按预期工作。

在 IFRAME 的 SRC 中添加 URL 使滚动条在 IE11 中消失(已测试)。

It may have something to do with the code INSIDE of the IFrame.它可能与 IFrame 内部的代码有关。 Try posting that in your question.尝试将其发布在您的问题中。 Also, you can research AJAX for JavaScript, and create a type of IFrame out of AJAX.此外,您可以研究用于 JavaScript 的 AJAX,并从 AJAX 中创建一种 IFrame。 Like you said before, it IS a bit confusing at first, comment on my answer if you need me to give a complete example.就像你之前说的,一开始有点混乱,如果你需要我给出一个完整的例子,请评论我的回答。 Here is a link to a basic example of AJAX: http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp这是 AJAX 基本示例的链接: http : //www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp
This will let you get the content of a page, copy and paste it into a div, and make it be a type of IFrame.这将让您获取页面的内容,将其复制并粘贴到一个 div 中,并使其成为一种 IFrame。 Then, you can also edit the code of the page, and set the attributes necessary (overflow:hidden) to the div.然后,您还可以编辑页面的代码,并为 div 设置必要的属性(溢出:隐藏)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM