jQuery(window).height inaccurate

后端 未结 6 1711
挽巷
挽巷 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:03

    Same problem here, it looks that jquery (and dom in general) is not calculating sizes correctly in quirksmode.

    Two solutions:

    1. Add doctype html at the top of your page, or
    2. Use window.innerHeight, window.innerWidth if first option is not an option.

    Hope it helps.

提交回复
热议问题