0

Hi all the following script was working fine on chrome and firefox but not in IE11. Any solutions please

window.onscroll = function (i) 
 { 
   window.innerHeight + window.scrollY >= document.body.offsetHeight ? 
   $("#str").removeClass("str_one") : $("#str").addClass("str_one") 
  };
Vikas Yadav
  • 3,094
  • 2
  • 20
  • 21
Prasath V
  • 1,336
  • 4
  • 20
  • 39
  • Did you try debugging it, e.g. logging the values of `window.innerHeight`, `window.scrollY`, and `document.body.offsetHeight`? – Ry- Jan 25 '18 at 07:30
  • 2
    window.scrollY not supported in IE https://developer.mozilla.org/ru/docs/Web/API/Window/scrollY you can use document.documentElement.scrollTop and check this https://stackoverflow.com/questions/16618785/ie8-alternative-to-window-scrolly – Drag13 Jan 25 '18 at 07:30

1 Answers1

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)];
    }
}
Ganesh Putta
  • 2,622
  • 2
  • 19
  • 26