Skip to content

Instantly share code, notes, and snippets.

@ofisia
Created February 27, 2013 09:15
Show Gist options
  • Save ofisia/5046545 to your computer and use it in GitHub Desktop.
Save ofisia/5046545 to your computer and use it in GitHub Desktop.
daftpunk.com source (February 27th, 2013)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" type="image/x-icon" href="favicon.ico?v=2" />
<title>Daft Punk</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<style>
body {background-color:#000; margin:0; padding:0}
#helmet {margin:100 auto 0 auto; padding:0; text-align: center; zborder:red thin dashed}
#helmet img {margin:0; padding:0; zborder:green thin dashed}
</style>
</head>
<body>
<center>
<div id="helmet">&nbsp</div>
</center>
<script>
function adjustHelmet() {
ow = 1500
oh = 1515
sw = $(window).width()
sh = $(window).height();
//alert('screen: ' + sw + ' : ' + sh)
if (sw < sh) {
iw = Math.round(0.95*sw);
ih = Math.round((iw*oh)/ow);
} else {
iw = (sw < 980) ? sw : 980;
ih = Math.round((iw*oh)/ow);
}
//alert(iw + ' : ' + ih)
if (ih+100 >= sh) {
ih = Math.round(0.95*sh);
iw = Math.round((ih*ow)/oh);
//alert('adjusted to -> ' + iw + ' : ' + ih)
}
$('#helmet').html('<img src="Helmets.jpg" width="' + iw + '" height="' + ih + '" alt="Daft Punk Helmets" />');
}
$(window).resize(function() { adjustHelmet() });
$(document).ready(function() { adjustHelmet(); });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment