Created
March 20, 2010 17:18
-
-
Save stilist/338776 to your computer and use it in GitHub Desktop.
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
<!doctype html> | |
<html lang='en'> | |
<head> | |
<meta charset='UTF-8'> | |
<title>Overlay toy</title> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script> | |
<script> | |
$(document).ready(function () { | |
$("div.open span").click(function () { | |
$overlay = $("<div>").attr("id", "overlay"). | |
css("width", ($("body").width())); | |
$overlay.append($("<h1>").text("Click ‘close’ to hide the overlay")); | |
$overlay.append($("<span>").addClass("close btn").text("close")); | |
$("body").append($overlay); | |
$overlay.animate({ "height" : $("html").height() + 20 }); | |
}); | |
$("#overlay .close").live("click", function () { | |
$("#overlay").animate({ "height" : 0 }, "fast", function () { | |
$(this).remove(); | |
}); | |
}); | |
}); | |
</script> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
body { | |
background-color: #eee; | |
color: #333; | |
font: 62.5% 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
line-height: 1.8em; | |
margin: 0 auto; | |
padding-top: 10px; | |
position: relative; | |
width: 500px; | |
} | |
h1 { | |
font-weight: normal; | |
margin: 10px 0; | |
text-align: center; | |
} | |
p { | |
font-size: 1.3em; | |
margin: 10px 0; | |
} | |
.btn { | |
background-color: #ccc; | |
border: 1px solid #999; | |
color: #000; | |
padding: 2px 4px; | |
-webkit-border-radius: 4px; | |
-moz-border-radius: 4px; | |
border-radius: 4px; | |
} | |
#overlay { | |
background-color: #333; | |
color: #ddd; | |
margin: 0 -20px; | |
position: absolute; | |
top: 0; | |
padding: 10px 20px; | |
-webkit-border-bottom-right-radius: 20px; | |
-webkit-border-bottom-left-radius: 20px; | |
-moz-border-radius-bottomright: 20px; | |
-moz-border-radius-bottomleft: 20px; | |
border-bottom-right-radius: 20px; | |
border-bottom-left-radius: 20px; | |
} | |
#overlay .close { | |
position: absolute; | |
right: 20px; | |
bottom: 20px; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Click ‘open’ to reveal the overlay</h1> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
<div class='open'><span class='btn'>open</span></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment