Get the App
SLTechnology News&Howtos  ›  Development  › 

How to get the initialization size of Mobile device by JavaScript

Shulou Source: shulou.com Published: 2022-06-01 02:56:35 09月22日 Update

This article mainly introduces how to obtain the initialization size of mobile devices by JavaScript, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.

Get the mobile device initialization size function getInitZoom () {

If (! this._initZoom) {

Var screenWidth = Math.min (screen.height, screen.width)

If (this.isAndroidMobileDevice () & &! this.isNewChromeOnAndroid ()) {

ScreenWidth = screenWidth / window.devicePixelRatio

}

This._initZoom = screenWidth / document.body.offsetWidth

}

Return this._initZoom

} Thank you for reading this article carefully. I hope the article "how to obtain the initialization size of mobile devices" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!

Tags: Articles size device mobile value interest at the same time more friends knowledge editing industry information information channels channels reference learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Redmi Shulou Information Shulou Technology Huawei