脚本(window.innerHeight)无法在IE中运行

时间:2018-01-25 07:28:32

标签: javascript jquery internet-explorer

嗨以下所有脚本在chrome和firefox上运行正常但在IE11中没有。任何解决方案

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

1 个答案:

答案 0 :(得分:0)



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)];
    }
}