当前位置:网站首页>JS get DPI, PX to cm, cm to PX
JS get DPI, PX to cm, cm to PX
2022-07-03 14:08:00 【Cheat the old traditional Chinese medicine in the Jianghu】
// obtain DPI
function js_getDPI() {
var arrDPI = new Array();
if ( window.screen.deviceXDPI != undefined ) {
arrDPI[0] = window.screen.deviceXDPI;
arrDPI[1] = window.screen.deviceYDPI;
}
else {
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 );
arrDPI[0] = parseInt( tmpNode.offsetWidth );
arrDPI[1] = parseInt( tmpNode.offsetHeight );
tmpNode.parentNode.removeChild( tmpNode );
}
return arrDPI;
}because :1 Inch = 2.54cm
px turn cm:cm = pxValue/dpi*2.54
px = cm/2.54*dpi
边栏推荐
- [développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes
- JVM object lifecycle
- Redis:字符串类型数据的操作命令
- Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:
- 金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
- QT learning 23 layout manager (II)
- GoLand 2021.1.1: configure the multi line display of the tab of the open file
- Global event bus
- MySQL data processing value addition, deletion and modification
- MySQL 数据处理值增删改
猜你喜欢

Qt学习21 Qt 中的标准对话框(下)

QT learning 22 layout manager (I)

28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;

jvm-运行时数据区

Spring cup eight school league
![[développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes](/img/f3/a219fe8e7438b8974d2226b4c3d4a4.png)
[développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes

Rasp implementation of PHP

使用vscode查看Hex或UTF-8编码

小项目(servelt+jsp+mysql+EL+JSTL)完成一个登录功能的Servlet,具有增删改查的操作。实现登录身份验证,防止非法登录,防止多点登录,记住用户名密码功能。

3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
随机推荐
Failure of vector insertion element iterator in STL
Dynamic programming 01 knapsack and complete knapsack
Scroll detection, so that the content in the lower right corner is not displayed at the top of the page, but is displayed as the mouse slides
Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
Metal organic framework MOFs loaded with non steroidal anti-inflammatory drugs | zif-8 wrapped Prussian blue loaded quercetin (preparation method)
How to bold text in AI
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
Go: send the get request and parse the return JSON (go1.16.4)
Redis:Redis的数据结构、key的操作命令
Golang - command line tool Cobra
3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
Use and design of Muduo buffer class
Redis: commandes d'action pour les données de type chaîne
GoLand 2021.1.1: configure the multi line display of the tab of the open file
Installation impression notes
Redis: redis data structure and key operation commands
JS matrix zero
simpleParallax. JS (create poor visual effects for website pictures)
JVM object lifecycle
Qt学习21 Qt 中的标准对话框(下)