0

During testing, I found out that few very large dimension device Oppo (5.5") has screen.widthequals to 360pxwhere as lower dimension device like iPhone 7 has screen.width equals to 375px.

How do I understand the nuances and measure the device width effectively?

Jagajit Prusty
  • 1,852
  • 1
  • 13
  • 35

2 Answers2

0

px means pixel i.e. number of illuminated spots. This is only dependant on the screen resolution, not the width as a unit of length.

Tanque
  • 182
  • 1
  • 14
0

If you want the effective window width you can try this.

console.log($(window).width()); // returns width of browser viewport
console.log($(window).height()); // returns height of browser viewport
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

For more details read this

tuhin47
  • 2,500
  • 2
  • 9
  • 18