Created
May 5, 2012 17:34
-
-
Save lerivin/2604219 to your computer and use it in GitHub Desktop.
An IE detection script with css setup via jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ieDetection = (function(){ | |
var | |
minVersion = 7 | |
, maxVersion = 10 | |
, currentVersion = minVersion | |
; | |
while(currentVersion <= maxVersion) { | |
var div = $('<div></div>').css('display', 'none'); | |
var string = '<!--[if IE ' | |
+ currentVersion | |
+ ']><script>' | |
+ '$(document.body).addClass("ie' + currentVersion + '");' | |
+ '</script><![endif]-->'; | |
div.html(string) | |
$(document.body).append(div); | |
currentVersion++; | |
} | |
} | |
); | |
$(document).ready( | |
function(){ | |
ieDetection(); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment