当前位置:网站首页>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;
};
边栏推荐
- Linphone 被叫方如何解析来电SIP消息中的自定义头消息
- 基于 outline 实现头像剪裁以及预览
- golang source code analysis: uber-go/ratelimit
- The five classification of software testing
- LM小型可编程控制器软件(基于CoDeSys)笔记二十五:plc的数据存储区(数字量输入通道部分)
- Golang source code analysis: juju/ratelimit
- 【数据分析】:什么是数据分析?
- 【SLAM】DM-VIO(ros版)安装和论文解读
- 博客主页rrs代码
- ALV report learning summary
猜你喜欢

Tencent YunMeng every jie: I experienced by cloud native authors efficiency best practices case

实现fashion_minst服装图像分类

SQL Server安装教程

ssdp协议搜索GB28181设备

A brief discussion on the transformation of .NET legacy applications

Informatics orsay a tong (1258: 【 9.2 】 digital pyramid)

KDD 2022 | 深度图神经网络中的特征过相关:一个新视角

Helm基础知识

【实战 已完结】WPF开发自动化生产管理平台

WPF development through practical 】 【 automatic production management platform
随机推荐
ALV report learning summary
callback prototype __proto__
信息学奥赛一本通(1258:【例9.2】数字金字塔)
Geoip2 - golang golang source code analysis
Packages and packages, access modifiers
Flutter 常见异常分析
go——内存分配机制
模板的进阶
Flink Yarn Per Job - 创建启动Dispatcher RM JobManager
网络协议介绍
信息学奥赛一本通(1256:献给阿尔吉侬的花束)
【手撕AHB-APB Bridge】~ AMBA总线 之 APB
信息学奥赛一本通(1259:【例9.3】求最长不下降序列)
STP生成树协议
Details in C# you don't know
ssdp协议搜索GB28181设备
Likou Question of the Day - Day 46 - 344. Reverse Strings
"A daily practice, happy water problem" 1374. Generate a string with an odd number of each character
56.【全局变量和局部变量专题】
Implement fashion_minst clothing image classification