dpi--and height of the various models displayed on Google analog phones and real machines

Source: Internet
Author: User

* * The following data has not been rigorously tested and will be re-tried in future work * *

var dpi = window.devicepixelratio;//Get screen resolution
Alert ("DPI is:" +dpi);
Alert ("$ (window). Height () is:" +$ (window). Height ());
Alert ("Document.body.offsetHeight:" +document.body.offsetheight);
Alert ("Window.innerheight:" +window.innerheight);
Alert ("Document.documentElement.clientHeight:" +document.documentelement.clientheight)
Alert ("Window.screen.availHeight:" +window.screen.availheight);

var currentscreenheight =$ (window). Height ()/dpi; Doesn't seem to need to be divided by DPI, do not know what happened, may be where there is a wrong, and then again

===================================== Split Line ==================================================

Each screen test dpi--$ (window). Height ()--document.body.offsetheight-- Window.innerheight--document.documentelement.clientheight--window.screen.availheight
Google simulation 6 Plus:3 736 736 736 736 736
Google Analog Note3:3 640 640 640 640 640
Google simulation 5:2 568 568 568 568 568

Apple 5 Real machine: 2 460 460 460 460 460 548
Lenovo Real Machine (company, model unknown): 2 640 640 640 640 1280
Meizu Real Machine (company, model unknown): 3 640 640 640 1920

Summary: In this case, the mobile phone side of the dynamic access to height, in addition to the window.screen.availHeight can not be used, all other
Some people say scrollheight|width can also, I have not tried.
The returned value needs to be divided by the phone's DP1

dpi--and height of the various models displayed on Google analog phones and real machines

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.