To achieve this effect, you can utilize jQuery's $.animate() function in combination with some CSS. Here is an example:
Check out the fiddle demonstration here: http://jsfiddle.net/6dnRy/
CSS
.container {
position: relative;
float: left;
margin: 10px;
width: 250px;
height: 250px;
overflow: hidden;
}
.inner {
position: absolute;
top: 0;
}
.itemTop {
width: 250px;
height: 250px;
background: #ccc;
}
.itemBottom {
width: 250px;
height: 250px;
background: #fff000;
}
HTML
<div class="container">
<div class="inner">
<div class="itemTop">Top</div>
<div class="itemBottom">Bottom</div>
</div>
</div>
<div class="container">
<div class="inner">
<div class="itemTop">Top</div>
<div class="itemBottom">Bottom</div>
</div>
</div>
JavaScript
/**
* $.on() is jQuery 1.7+
* use $('.container').click(function(e){... for < 1.7
*/
$(document).on('click', '.container', function(e){
e.preventDefault(); // Prevent Default Action
$('.inner').animate({top:0}, 'linear'); // Reset Other Containers
$('.inner', this).animate({top:-250}, 'linear'); // Animate Clicked Container
});
I trust this explanation will be beneficial!