Last active
December 28, 2015 11:35
-
-
Save oleksapro/5c04e2212e60f7fe9bc9 to your computer and use it in GitHub Desktop.
html, js
This file contains hidden or 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
JS | |
1. http://codepen.io/gapcode/pen/vEJNZN | |
HTML + JS | |
2. http://stackoverflow.com/questions/10964966/detect-ie-version-prior-to-v9-in-javascript | |
<!doctype html> | |
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]--> | |
<!--[if IE 7 ]> <html class="ie7"> <![endif]--> | |
<!--[if IE 8 ]> <html class="ie8"> <![endif]--> | |
<!--[if IE 9 ]> <html class="ie9"> <![endif]--> | |
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]--> | |
<head> | |
And add some simple script: | |
(function ($) { | |
"use strict"; | |
// Detecting IE | |
var oldIE; | |
if ($('html').is('.ie6, .ie7, .ie8')) { | |
oldIE = true; | |
} | |
if (oldIE) { | |
// Here's your JS for IE.. | |
} else { | |
// ..And here's the full-fat code for everyone else | |
} | |
}(jQuery)); | |
#main.css | |
.ie-only { display: none } | |
#ie-only.css | |
.ie-only { display: block } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment