zoukankan      html  css  js  c++  java
  • 条件注释判断IE浏览器

    最近在用jquery 2.0 才知道已不支持IE6/7/8

    但又不想换回 jquery 1.X;

    找了一资料发现条件注释可以解决这个问题

    这个也像程序中的条件判断,先来介绍几个单词
    lt :Less than的简写,小于的意思。
    lte :Less than or equal to的简写,小于或等于的意思。
    gt :Greater than的简写,大于的意思。
    gte:Greater than or equal to的简写,大于或等于的意思。

    <!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]-->
    <!--[if IE]> 所有的IE可识别 <![endif]-->
    <!--[if IE 6]> 仅IE6可识别 <![endif]-->
    <!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->
    <!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
    <!--[if IE 7]> 仅IE7可识别 <![endif]-->
    <!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->
    <!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]-->
    <!--[if IE 8]> 仅IE8可识别 <![endif]-->
    <!--[if IE 9]> 仅IE9可识别 <![endif]-->

    下面的是实践代码,用了百度的CDN,大家可以借鉴一下

        <!--[if gte IE 9]>
        <script src="http://libs.baidu.com/jquery/2.0.3/jquery.min.js"></script>
        <![endif]-->
        <!--[if lt IE 9]>
        <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
        <![endif]-->
        <!--[if !IE]><!-->
        <script src="http://libs.baidu.com/jquery/2.0.3/jquery.min.js"></script>
        <!--<![endif]-->
  • 相关阅读:
    138.安全退出的异常,要用throw 尽量不用exit(0)
    137.CPP自带异常
    136.异常的多态,父类对象,传递子类的引用或指针(地址)
    135.异常与类继承
    134.异常类的处理
    133.throw机制 抛出类类型
    132.try throw catch介绍
    CF1039D You Are Given a Tree
    CF576E Painting Edges
    【模板】并查集维护生成树
  • 原文地址:https://www.cnblogs.com/william-lin/p/4481637.html
Copyright © 2011-2022 走看看