2

我正在制作一个重叠的屏幕(如 facebook 照片查看器),现在它在 chrome、safari 和 firefox 中运行良好,但我也需要它在 IE 中运行。实际上 div 像我想要的那样完美重叠,但它允许它滚动,我不想这样做。所以我尝试使用溢出:隐藏;单击按钮时,它不会滚动。它工作正常,但现在我的问题是让它再次滚动。我都尝试过 overflow: auto 和一些 jquery 函数,但它似乎不起作用。而且我还检测到它不会执行 jquery,例如 $(document).ready(function() { ... });

我用来重叠的代码:

var outercontent = document.getElementById('transparent')
var innercontent = document.getElementById('innercont')
browser = navigator.appName;
explore = "Microsoft Internet Explorer";
if(browser == explore) {
    outercontent.style.zIndex = '9989';
    outercontent.style.display = 'block';
    outercontent.style.position = 'absolute';
    outercontent.style.top = '0';
    outercontent.style.left = '0';
    outercontent.style.width = viewportwidth;
    outercontent.style.height = viewportheight;
    outercontent.style.margin = '0';
    outercontent.style.padding = '0';

    innercontent.style.left = '20%';
    innercontent.style.background = 'white';
    innercontent.style.zIndex = '9999';
    innercontent.style.width = '60%';
    innercontent.style.height = '80%';
    innercontent.style.marginBottom = '10%';
    innercontent.style.marginTop = '5%';
    innercontent.style.padding = '10px';

}

在我的 html 页面中,我放置了 div:

<div id='transparent' style='background-color: rgba(0, 0, 0, 0.5);
filter:
progid:DXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr='#e5000000',EndColorStr='#e5000000');
text-align: center;'>
    <div id='innercont' style='position: absolute; color: black;'></div>
</div>
4

1 回答 1

0

如何将您的内容包装在<div>with height: 100%; overflow: hidden;inside of 中#innercont?那应该更可控。

于 2012-07-16T12:30:32.747 回答