【问题标题】:Script (window.innerHeight) not working in IE脚本 (window.innerHeight) 在 IE 中不起作用
【发布时间】:2018-01-25 15:34:14
【问题描述】:

您好,以下所有脚本在 chrome 和 firefox 上都可以正常工作,但在 IE11 中却不行。请问有什么解决办法

window.onscroll = function (i) 
 { 
   window.innerHeight + window.scrollY >= document.body.offsetHeight ? 
   $("#str").removeClass("str_one") : $("#str").addClass("str_one") 
  };

【问题讨论】:

标签: javascript jquery internet-explorer


【解决方案1】:

window.getWindowSize= function(){
    if(window.innerWidth!= undefined){
        return [window.innerWidth, window.innerHeight];
    }
    else{
        var docBody= document.body, 
        docEle= document.documentElement;
        return [Math.max(docEle.clientWidth, docBody.clientWidth),
        Math.max(docEle.clientHeight, docBody.clientHeight)];
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-10
    • 1970-01-01
    • 2010-11-16
    • 1970-01-01
    相关资源
    最近更新 更多