Skip to content

Instantly share code, notes, and snippets.

@svieira
Forked from subtleGradient/global.jq.js
Created September 17, 2010 21:51
Show Gist options
  • Save svieira/585019 to your computer and use it in GitHub Desktop.
Save svieira/585019 to your computer and use it in GitHub Desktop.
// Swap classes onload and domready
$(function(){ $('html').removeClass('not-ready').addClass('ready'); }); // jQuery
$(window).load(function(){ $('html').removeClass('loading').addClass('loaded'); });
// target a specific version
if (navigator.isIE == 6){
// do stuff for IE6
}
// Deliever different behaviour for a group of IE versions
if (navigator.isIE < 9){
// ie's notorious png-tranparent-pixels-go-black-on-fade issue
$('png-image').hide();
} else {
$('png-image').hide(400);
}
// Check for IE generally
if (navigator.isIE){
// do IE stuff
} else {
// do other stuff since NaN is falsey
}
// Swap classes onload and domready
document.addEvent('domready',function(){ $$('html').removeClass('not-ready').addClass('ready'); }); // MooTools
document.addEvent('load',function(){ $$('html').removeClass('loading').addClass('loaded'); }); // MooTools
// target a specific version
if (navigator.isIE == 6){
// do stuff for IE6
}
// Deliever different behaviour for a group of IE versions
if (navigator.isIE < 9){
// ie's notorious png-tranparent-pixels-go-black-on-fade issue
$('png-image').setStyle('display','none');
} else {
$('png-image').fade('out');
}
// Check for IE generally
if (navigator.isIE){
// do IE stuff
} else {
// do other stuff since NaN is falsey
}
<!DOCTYPE html>
<html lang=en class=no-js>
<head>
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<!--[if IE]><![endif]-->
<!--[if IE]><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><![endif]-->
<title>Page Title - Site Title</title>
<meta name=description content="">
<meta name=keywords content="">
<meta name=author content="">
<script>try{
if(typeof navigator=='undefined')navigator={};
HTML=document.getElementsByTagName('html')[0];
HTML.className="js loading not-ready";
HTML.className+=(this.top===this.window?' not-':' ')+'framed';
}catch(e){}</script>
<meta name=viewport content="width=device-width; initial-scale=1.0;">
<!--[if IE 9]><script>try{HTML.className+=' ie9'}catch(e){};navigator.isIE=9</script><![endif]-->
<!--[if IE 8]><script>try{HTML.className+=' ie8'}catch(e){};navigator.isIE=8</script><![endif]-->
<!--[if IE 7]><script>try{HTML.className+=' ie7'}catch(e){};navigator.isIE=7</script><![endif]-->
<!--[if IE 6]><script>try{HTML.className+=' ie6'}catch(e){};navigator.isIE=6</script><![endif]-->
<!--[if lt IE 6]><script>try{HTML.className+=' ie5'}catch(e){};navigator.isIE=5</script><![endif]-->
<!--[if gt IE 9]><script>try{HTML.className+=' ie10'}catch(e){};navigator.isIE=10</script><![endif]-->
<!--[if !IE]>--><script>try{HTML.className+=' not-ie'}catch(e){};navigator.isIE=NaN</script><!-- <![endif]-->
<link rel=stylesheet href="css/style.css?v=1">
<link rel=stylesheet href="css/handheld.css?v=1" media=handheld>
<script src="js/modernizr.js?v=1"></script>
</head>
<body>
<div class=page>
<div class=head>
</div>
<div class=body>
<div class=leftCol>
</div>
<div class=rightCol>
</div>
<div class=main>
</div>
</div>
<div class=foot>
</div>
</div>
<script src="js/framework.js?v=1"></script>
<script src="js/app.js?v=1"></script>
<!--[if lt IE 7]><script src="js/dd_belatedpng.js?v=1"></script><![endif]-->
<script>
if(document.location.hash.indexOf('DEBUG')+1){
document.write('<script src="js/profiling/yahoo-profiling.min.js?v=1"><\/script>');
document.write('<script src="js/profiling/config.js?v=1"><\/script>');
}
_gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
;(function(d,t,src){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=true;g.src=src;s.parentNode.insertBefore(g,s)})
(document,'script','//www.google-analytics.com/ga.js')
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment