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

前端 未结 7 2066
渐次进展
渐次进展 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:21

    I had the same problem. I've found some things:

    1) the problem happens when you try to get the actual height before document is completed rendered; 2) the problem happens in google chrome when you does not use corret DOCTYPE (mentioned above) 3) it always happens in google chrome even after the document is rendered completly.

    For google chrome, I've found a workaround here: get-document-height-cross-browser I'm using this solution only for google chrome and it resolved my problem, I expect helps someone that still have the problem.

提交回复
热议问题