copia e incolla
demo : http://jsfiddle.net/fcalderan/uTB7y/
codice:
<!doctype html>
<html lang="it">
<head>
<meta charset="utf-8" />
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"> </script>
<style>
body {
background : #000;
font : 16px, Arial;
}
#cnt {
width : 500px;
height : 500px;
position : relative;
z-index : 1;
margin : 0 auto;
}
#cnt section {
width : 250px;
height : 250px;
position : absolute;
z-index : 1;
text-align : center;
cursor : pointer;
}
#b1, #b2 { top : 0; }
#b2, #b4 { right : 0; }
#b3, #b4 { bottom : 0; }
#b1, #b3 { left : 0; }
</style>
<script>
document.createElement('section')
$(document).ready(function() {
$('section').bind('click', function() {
var $this = $(this), transition = {};
transition = ($this.hasClass('opened'))
? { width: '250', height: '250' }
: { width: '500', height: '500' };
if (!$this.hasClass('opened')) {
$this.css('z-index', '2')
}
$this
.stop()
.animate(transition, 500, function() {
$this.toggleClass('opened')
if (!$this.hasClass('opened')) {
$this.css('z-index', '1')
}
});
});
})
</script>
</head>
<body>
<div id="cnt">
<section id="b1" style="background: #575066;">
<h1>HTML5</h1>
</section>
<section id="b2" style="background: #78626F;">
<h1>looks</h1>
</section>
<section id="b3" style="background: #5A6752;">
<h1>great</h1>
</section>
<section id="b4" style="background: #C0899C;">
<h1>dude!</h1>
</section>
</div>
</body>
</html>