在设计获取元素的精确样式值第三版的过程中,需要有到PDI值。参考hax的函数,搞出这个:

        var DPI = window.screen.logicalXDPI || (function(){
          var el = document.createElement("div"),s = el.style,
          root = document.documentElement
          s.margin = s.borderWidth = s.padding = '0'
          s.maxWidth = s.minWidth = s.width = '1in'
          root.insertBefore(el,null);
          return  s.pixelWidth || parseInt(window.getComputedStyle(el,null).width)
        })() ;

相关文章:

  • 2021-08-15
  • 2022-02-21
  • 2021-05-18
  • 2021-08-12
  • 2022-12-23
  • 2021-05-28
  • 2022-01-08
  • 2022-02-07
猜你喜欢
  • 2022-12-23
  • 2021-11-28
  • 2021-11-18
  • 2021-12-27
  • 2022-12-23
  • 2021-06-18
  • 2022-01-08
相关资源
相似解决方案