在 window.load中添加:

(function(){
 	if (!window.screen.deviceXDPI){
       var tmpNode = document.createElement("DIV");
        tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
        document.body.appendChild(tmpNode);
        window.screen.deviceXDPI = parseInt(tmpNode.offsetWidth);
        window.screen.deviceYDPI = parseInt(tmpNode.offsetHeight);
        tmpNode.parentNode.removeChild(tmpNode);
 	}

    //宽度毫米
    window.screen.width_mm =  window.screen.width / window.screen.deviceXDPI * 25.4;
    window.screen.height_mm =  window.screen.height / window.screen.deviceYDPI * 25.4;
})()

可以根据 屏幕的真实宽度与高度进行适配.

一些链接

http://blog.csdn.net/cuixiping/article/details/45966177
https://www.pengxb.com/
http://yincheng.site/crop-upload-photo

相关文章:

  • 2022-12-23
  • 2021-07-26
  • 2021-11-16
  • 2021-09-06
  • 2021-10-01
  • 2021-08-11
猜你喜欢
  • 2021-12-24
  • 2021-04-12
相关资源
相似解决方案