Skip to content

Instantly share code, notes, and snippets.

@lojjic
Created February 18, 2013 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lojjic/4981401 to your computer and use it in GitHub Desktop.
Save lojjic/4981401 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
#one, #two, #three {
position: absolute;
width: 200px;
height: 200px;
background: #EEE;
border: 1px solid #666;
}
#one {left: 20px; top: 20px; z-index: 1;}
#two {left: 40px; top: 40px; z-index: 2;}
#three {left: 60px; top: 60px; z-index: 3;}
#test {
position: absolute; top: 0; left: 0;
background: lightblue;
width: 200px; height: 200px;
border-radius: 20px;
behavior: url(../build/PIE.htc);
}
</style>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="../build/PIE_IE678.js"></script>
<script type="text/javascript">
$(function() {
var indexes = [0,1,2,3,4];
$('#test').click(function() {
var z = this.style.zIndex = indexes.shift();
indexes.push(z);
//this makes it work: this.style.top = this.offsetTop + 1 + 'px'
})
})
</script>
</head>
<body>
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
<div id="test"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment