zoukankan      html  css  js  c++  java
  • 兼容问题

    ie8 video无法播放视频

    <!--[if lt IE9]> 
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>//加上这个video可播放视频
    <![endif]-->
    

    判断用户是否用ie浏览器(兼容ie8-ie11)

    function isIE() {
        if (!!window.ActiveXObject || "ActiveXObject" in window){
          alert('是ie')
            // return true;
        }else{
          alert('不是ie')
            // return false;
        }
     }
    
    

    判断用户是否缩放

    
    function detectZoom (){
      var 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;
    };
    
  • 相关阅读:
    选校总结
    位运算
    剑指
    机器学习之梯度下降法
    leetcode1348 Tweet Counts Per Frequency
    UVA10308 Roads in the North 树的最长路径
    负数的处理POJ1179Polygon
    Roadblocks
    Bus Stop
    蒜头君的城堡之旅(动态规划)
  • 原文地址:https://www.cnblogs.com/hyx626/p/10006078.html
Copyright © 2011-2022 走看看