i know there are 1'000 questions about this but i just can't make this to work. i simply want to target ALL versions of IE (IE11 included) and give the html a certain class, and for all the other browsers (firefox, opera, chrome) i want the html to have another class or even no class at all. here's my non-working code:
<!-- [if IE] --> <html lang="en" class="legacy"><!-- [endif] -->
<!-- [if !IE] --> <html lang="en" class="modern"><!-- [endif] -->
what's wrong with this? i'm getting class="legacy"
everywhere :\
a generic javascript solution to target any IE browser will do just fine too!
this is the use case:
i'm using skrollr jquery plugin, and i'm destroying it with enquire.js for mobile and as it's not working working on explorer (and partially not working in IE11 too.. yeah.. IE just won't get it right in ANY case) i have a function that looks like this:
var $html = $("html");
function enableSkrollr() {
var s = skrollr.init({
forceHeight : false
});
}//enable
function disableSkrollr() {
var s = skrollr.init();
s.destroy();
}//disable
if ($html.hasClass("modern")) {
enquire.register("screen and (min-width: 1140px)", {
match : function() {
enableSkrollr();
},
unmatch : function() {
disableSkrollr();
}
});
};
so i'm relying on that modern
class in the html
tag