当前位置:网站首页>js how to get the browser zoom ratio
js how to get the browser zoom ratio
2022-08-02 23:38:00 【hzxOnlineOk】
function getZoom(){
let ratio = 0,
screen = window.screen,
ua = navigator.userAgent.toLowerCase();
if (window.devicePixelRatio !== undefined) {
ratio = window.devicePixelRatio;
} else if (~ua.indexOf('msie')) {
if (screen.deviceXDPI && screen.logicalXDPI) {
ratio = screen.deviceXDPI / screen.logicalXDPI;
}
} else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
ratio = window.outerWidth / window.innerWidth;
}
if (ratio){
ratio = Math.round(ratio * 100);
}
return ratio;
};
边栏推荐
猜你喜欢
随机推荐
HCIP--BGP基础实验
EasyExcel dynamic parsing and save table columns
KDD 2022 | 深度图神经网络中的特征过相关:一个新视角
【SLAM】DM-VIO(ros版)安装和论文解读
PLC工作原理动画
C#异步和多线程
golang source code analysis: uber-go/ratelimit
开关、电机、断路器、电热偶、电表接线图大全
Which thread pool does Async use?
五大维度解读软件测试分类
2022年金九银十,Android面试中高频必问的问题汇总
The five classification of software testing
奥特学园ROS笔记--7(289-325节)
LM小型可编程控制器软件(基于CoDeSys)笔记二十五:plc的数据存储区(数字量输入通道部分)
MSTP与STP
golang 源码分析:uber-go/ratelimit
10 种最佳 IDE 软件 ,你更忠爱哪一个?
Nervegrowold hands-on learning deep learning V2 - Bert pre training data set and code implementation
ssdp协议搜索GB28181设备
Flink Yarn Per Job - 启动AM








