Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pixel to MM equation?

Tags:

jquery

pixel

Is there a reliable equation to work out pixel size to MM? Or is that not possible cross device?

We are working with a bespoke system that delivers content to many devices with different screen sizes, it can detect the screen width in MM, but we would like to accurately convert this to pixel size to deliver correctly sized images dynamically using a simple jquery script!?

Any ideas?

Cheers Paul

like image 881
Dancer Avatar asked Oct 04 '11 15:10

Dancer


1 Answers

What i did :

 <div id="my_mm" style="height:100mm;display:none"></div>

Then:

var pxTomm = function(px){   
   return Math.floor(px/($('#my_mm').height()/100)); //JQuery returns sizes in PX
 };
like image 63
Dawa Avatar answered Oct 28 '22 03:10

Dawa