Created
September 13, 2010 04:15
-
-
Save 0xnbk/576795 to your computer and use it in GitHub Desktop.
Detect browser
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
//A. Target Safari | |
if( $.browser.safari ) $("#menu li a").css("padding", "1em 1.2em" ); | |
//B. Target anything above IE6 | |
if ($.browser.msie && $.browser.version > 6 ) $("#menu li a").css("padding", "1em 1.8em" ); | |
//C. Target IE6 and below | |
if ($.browser.msie && $.browser.version <= 6 ) $("#menu li a").css("padding", "1em 1.8em" ); | |
//D. Target Firefox 2 and above | |
if ($.browser.mozilla && $.browser.version >= "1.8" ) $("#menu li a").css(" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Detect browser
Although it is better to use CSS conditionnal comments to detect a specific browser and apply some css style, it is a very easy thing to do with JQuery, which can be useful at times.