0

我的应用程序在 IE8 中运行良好,现在我们正在迁移到 IE11。请在下面找到 div css

.contentDiv{
  height:expression(document.body.clientHeight - contentDiv.getBoundingClientRect().top);
  overflow-y:scroll;
}

现在css表达式已经贬值了。您能否建议我如何计算 IE11 的动态 div 宽度高度,并且它也应该在 IE8 中工作?

4

1 回答 1

0

如果您在站点上有 jQuery(并且您应该),那么您可以让 jQuery 快速循环使用该类的元素并明确设置高度。

$(document).ready(function(){
    $('.contentDiv').each(function(){
        $(this).css('height',$(document).height() - $(this)[0].getBoundingClientRect().top);
    });
});

您需要将overflow-y:scroll;样式定义保留在 CSS 中。

于 2015-08-06T22:29:39.210 回答