Jquery $(window).height() function does not return actual window height

前端 未结 7 2099
渐次进展
渐次进展 2020-12-09 16:09

I have a page that I need to dynamically load ajax content when the user scrolls to the bottom. The problem is that JQuery is not returning the correct window height. I have

7条回答
  •  一整个雨季
    2020-12-09 16:31

    Since jquery (and dom in general) is not calculating sizes correctly in quirksmode, two solutions:

    1. Add doctype html at the top of your page (like mentioned in "correct" answer), or
    2. Use window.innerHeight, window.innerWidth if first option is not an option.

    Hope it helps.

提交回复
热议问题