当前位置:网站首页>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
边栏推荐
- Vite project commissioning
- jvm-类加载
- Go 1.16.4: purpose of go mod tidy
- Qt学习19 Qt 中的标准对话框(上)
- Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
- Reflection -- basic usage
- RocksDB LRUCache
- Multi person collaborative data annotation based on Baidu brain easydata from scratch
- 【吉林大学】考研初试复试资料分享
- JS first summary
猜你喜欢
Message subscription and publishing
Qt学习21 Qt 中的标准对话框(下)
Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock
QT learning 23 layout manager (II)
可编程逻辑器件软件测试
Example analysis of QT learning 18 login dialog box
Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
Go language unit test 3: go language uses gocovey library to do unit test
[email "/>
Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email
Redis: operation command of string type data
随机推荐
Go 1.16.4: purpose of go mod tidy
Invalid Z-index problem
Qt学习19 Qt 中的标准对话框(上)
FPGA test method takes mentor tool as an example
Reflection -- basic usage
[Jilin University] information sharing of postgraduate entrance examination and re examination
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
Raft 协议
Go language web development series 29: Gin framework uses gin contrib / sessions library to manage sessions (based on cookies)
Configure stylelint
Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
Redis: operation command of string type data
Implementation of Muduo asynchronous logging
怎样删除对象的某个属性或⽅法
RocksDB LRUCache
叶酸修饰的金属-有机骨架(ZIF-8)载黄芩苷|金属有机骨架复合磁性材料([email protected])|制备路线
Simulated access
Go: send the get request and parse the return JSON (go1.16.4)
3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
[ACNOI2022]猜数