IEのみに表示変更させるための分岐

IEに対応させるための条件分岐。
こちらを参考に。
http://w3g.jp/blog/tools/js_browser_sniffing
http://twihelp.me/qRdUu
http://www.nk0206.com/life/2009/04/jquery-1.html

(書き直すかも)

		$(function(){
			var _ua = (function(){
				return {
				ltIE6:typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined",
				ltIE7:typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined",
				ltIE8:typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined",
				IE:document.uniqueID,
				Firefox:window.sidebar,
				Opera:window.opera,
				Webkit:!document.uniqueID && !window.opera && !window.sidebar && window.localStorage && typeof window.orientation == "undefined",
				Mobile:typeof window.orientation != "undefined"
				}
			})();
			if(_ua.ltIE6 || _ua.ltIE7 || _ua.ltIE8 || _ua.IE && !_ua.ltIE8){
				$("#divSample").addClass("divSampleIe");
				return false;
			}else{
				return false;
			}
		});

投稿者:

ayako0802

フロントエンドエンジニア