jQuery(window).height inaccurate

后端 未结 6 1690
挽巷
挽巷 2021-01-04 07:24

I\'m doing a simple test on $(window).height() and I\'m getting a value of 2602 on a screen resolution of 1366 x 768.

jQuery(document).ready(function($){

           


        
6条回答
  •  借酒劲吻你
    2021-01-04 08:09

    This can be just as simple as a missing or incorrect DOCTYPE (affected Chrome but not IE).

    Interestingly this isn't even a jQuery issue - it affects document.documentElement.clientHeight too.

    Without doctype:

    enter image description here

    With doctype:

    
    

    enter image description here

    I thought I had a layout template on my page, but it turned out I didn't - and therefore didn't have DOCTYPE.

提交回复
热议问题