-1

I want to modify css of an element with jQuery only if the user agent is IE9 or later. How can I do this? This is my code:

var lancetta = $(document).find('.seconds');
        if(msie version is >= 9){
        lancetta.css({'-ms-transform' : 'rotateZ(360deg)'});
      }else{
        lancetta.css({'-webkit-transform' : 'rotateZ(360deg)',
                     '-moz-transform' : 'rotateZ(360deg)',
                     'transform' : 'rotateZ(360deg)'});
      }
  • This might be useful. Check the answer by Mario. http://stackoverflow.com/questions/19999388/check-if-user-is-using-ie-with-jquery – Kumar Dec 01 '15 at 21:21
  • I tried this way but it doesn't work. – Riccardo Dell'Omo Dec 01 '15 at 21:22
  • try this: http://www.sitepoint.com/check-ie-version/ ? – AlwaysNull Dec 01 '15 at 21:23
  • Thanks Jameson, but I tried these ways, but it doesn't work again. – Riccardo Dell'Omo Dec 01 '15 at 21:25
  • Some additional code samples of how you're trying the above solutions would be helpful. The approaches outlined in the links are valid, and should allow you to properly identify an Internet Explorer browser. Additionally, it's perfectly safe to include all of the `transform` prefixes for all browsers. The browsers will only use the ones they recognize. – cmptrgeekken Dec 01 '15 at 21:31

1 Answers1

0

You can try this:

var IE9 = document.all && !window.atob;
if (IE9)
{
  //IE9+ only
}
else
{
  //rest 
}