Skip to content

Instantly share code, notes, and snippets.

@rshk
Created January 3, 2014 17:24
Show Gist options
  • Save rshk/8242161 to your computer and use it in GitHub Desktop.
Save rshk/8242161 to your computer and use it in GitHub Desktop.
Jquery Windows
<!DOCTYPE html>
<html><head>
<title>Blah</title>
<style>
body {
background: #ddd;
}
#my-window {
position:absolute;
top:20px;
left:20px;
right:20px;
bottom: 20px;
background: #fff;
z-index: 100;
border-radius: 20px;
box-shadow: rgba(0,0,0,.2) 0 0 0 10px;
}
#my-window a.close {
content:"";
width:20px;
height:20px;
position:absolute;
right:10px;
top:10px;
border-radius:10px;
z-index: 101;
background: #f00;
}
</style>
</head><body>
<div id="my-window">
<a href="javascript:void(0)" class="close"></a>
</div>
<button id="my-button">Click me</button>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
$(function(){
$('#my-window').hide();
$('#my-button').click(function(){
$('#my-window a.close').click(function(){
$('#my-window').hide();
});
$('#my-window').show();
});
});
</script>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment