【问题标题】:Window.innerHeight conflict with bootstrapWindow.innerHeight 与引导程序冲突
【发布时间】:2015-09-29 14:16:55
【问题描述】:

我将引导程序添加到现有网页。网页使用 Javascript 来调整内容大小,所以

var containerHeight = window.innerHeight - header - footer

使用了几次。

由于我添加了引导程序,在调用 window.innerHeight 的每个页面的初始加载/刷新后,<html> 的高度是错误的(意味着出现水平滚动条)。 “额外”区域是纯白色的,调试工具告诉我,这是在 <body><html> 区域的 jsut 部分之外。

任何操作(调整窗口大小、背景事件,实际上任何东西)都会将高度重置为正确的 100%,并且水平滚动条会消失。

只要我用window.innerHeight 评论该行,问题就会消失。只是打电话!即使未应用结果值,该行也会导致问题。

这很好用:

//var containerHeight = window.innerHeight - header - footer
//$('.someClass').css('height',containerHeight)

这不是

var containerHeight = window.innerHeight - header - footer
//$('.someClass').css('height',containerHeight)

(同样适用于$(window).height() btw)

如何在不删除引导程序的情况下解决此问题。

另外我取出了bootstrap.js文件,测试一下是否有脚本冲突。

我重命名了几次变量,也看看它们是否会在某种程度上与任何引导集变量发生冲突...

我测试了max-height=100%; 和类似的东西,但它对我不起作用。

据我所知,该问题仅发生在 IE9 中。不幸的是,我必须使用这个浏览器,因为我的公司将它作为标准浏览器。

我通过 NuGet-Package Manager 获得了引导文件,因为我使用的是 ASP.NET

请告诉我,如果您需要更多信息,我很乐意提供。

【问题讨论】:

    标签: javascript html css asp.net twitter-bootstrap


    【解决方案1】:

    好的,我“暴力破解”了 bootstrap.css(注释掉前半部分,检查,然后是后半部分,对剩余区域重复)

    当我注释掉这部分时:

    .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 
     {
     position: relative;
     min-height: 1px;
     padding-right: 15px;
     padding-left: 15px;
     }
    

    问题解决了。

    如果有人可以向我解释这一点,我会接受相应的答案!

    【讨论】:

      猜你喜欢
      • 2016-11-11
      • 1970-01-01
      • 1970-01-01
      • 2017-03-21
      • 2012-12-06
      • 1970-01-01
      • 2015-10-28
      • 2014-06-19
      • 2020-10-22
      相关资源
      最近更新 更多