当前位置:网站首页>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;
};
边栏推荐
猜你喜欢
Tencent YunMeng every jie: I experienced by cloud native authors efficiency best practices case
线程安全(上)
谷歌竞价机器学习如何去理解?
美国爱荷华州立大学| Improving Distantly Supervised Relation Extraction by Natural Language Inference(通过自然语言推理改进远程监督关系提取)
.NET performance optimization - you should set initial size for collection types
李沐动手学深度学习V2-BERT预训练和代码实现
Packages and packages, access modifiers
信息学奥赛一本通(1258:【例9.2】数字金字塔)
"A daily practice, happy water problem" 1374. Generate a string with an odd number of each character
即时通讯开发移动端网络短连接的优化手段
随机推荐
ImageNet下载及处理
golang 源码分析:uber-go/ratelimit
信息学奥赛一本通(1260:【例9.4】拦截导弹(Noip1999))
PLC working principle animation
二丙二醇甲醚醋酸酯
STP生成树协议
你所不知道的C#中的细节
PLC工作原理动画
KDD 2022 | 深度图神经网络中的特征过相关:一个新视角
数据库分析与优化
【手撕AHB-APB Bridge】~ AMBA总线 之 APB
PyTorch分布式backends
Golang source code analysis: juju/ratelimit
Li Mu hands-on deep learning V2-BERT pre-training and code implementation
EasyExcel实现动态列解析和存表
博客主页rrs代码
callback prototype __proto__
软件测试的流程规范有哪些?具体要怎么做?
引用类型 ,值类型 ,小坑。
C# Barrier类