How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code?

前端 未结 25 3181
谎友^
谎友^ 2020-11-22 06:19

How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code?

I tried this, but

25条回答
  •  庸人自扰
    2020-11-22 06:32

    Perhaps you can try some jQuery like this:

    if ($.browser.msie && $.browser.version === 10) {
      $("html").addClass("ie10");
    }
    

    To use this method you must include the jQuery Migrate library because this function was removed from the main jQuery library.

    Worked out quite fine for me. But surely no replacement for conditional comments!

提交回复
热议问题