1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CSS switching for legacy browser (also CSS3 polyfill)

Last updated at Posted at 2013-04-13

// JS

var isIE = /*@cc_on!@*/false;
if (isIE)
{
    ////////////// specify CSS for IE ______________________________________
    var appVersion = window.navigator.appVersion.toLowerCase();
    var isIE6 = appVersion.indexOf("msie 6.0") > -1; 
    var isIE7 = appVersion.indexOf("msie 7.0") > -1; 
    var isIE8 = appVersion.indexOf("msie 8.0") > -1; 
    var isIE9 = appVersion.indexOf("msie 9.0") > -1; 
    if(isIE6) $('html').addClass('ie6')
    else if(isIE7) $('html').addClass('ie7')
    else if(isIE8) $('html').addClass('ie8')
    else if(isIE9) $('html').addClass('ie9');
    
    ////////////// CSS3 polyfill by CSS PIE _______________________________
    $.getScript('./js/PIE.js', function(){
        if (window.PIE) {
            $('selector').each(function() {
                PIE.attach(this);
            });
        }
    });
}

// CSS
.class {
something: 0;
}
.ie6 .class {
something: 1;
}
.ie7 .class {
something: 2;
}

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?