Mobile viewport height after orientation change

后端 未结 10 1407
孤街浪徒
孤街浪徒 2020-12-03 04:30

I am attaching a listener to the orientationchange event:

window.addEventListener(\'orientationchange\', function () {
    console.log(window.innerHeight);
}         


        
10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-03 05:00

    I also faced the same problem. So I ended up using:

    window.onresize = function(){ getHeight(); }
    

提交回复
热议问题