zoukankan      html  css  js  c++  java
  • JS 获取浏览器显示比例,缩放比例

    function getDetectZoom (){ 
      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;
    };
  • 相关阅读:
    HDU4565
    CF861D
    UVA 11651
    HDU5950
    POJ3267
    POJ1094
    POJ1905
    HDU3567
    进程的同步与互斥
    预防死锁,检测死锁,避免死锁,解除死锁....
  • 原文地址:https://www.cnblogs.com/weblff/p/14145124.html
Copyright © 2011-2022 走看看