why is $(window).height() so wrong?

前端 未结 6 992
遥遥无期
遥遥无期 2020-12-10 11:21

I\'m trying to get the current browser viewport height, using

$(window).on(\'resize\',function() { 
  console.log(\"new height is: \"+$(window).height()); 
         


        
6条回答
  •  误落风尘
    2020-12-10 11:40

    For those who still has problem after above solutions...

    Please check the view ratio of browser onto your project.html..

    The value of $(window).height() is not as same as 'real' pixels of client area when the view ratio adjusted! (and so others $(xx).width()...in this situation)

    (The browser remembered my careless 110% ratio adjusted days ago...)

提交回复
热议问题