Forum Moderators: open
//Set div dimensions equal to image's dimensions:
$('#image_holder_1').width($('#image_1').width(300));
$('#image_holder_1').height($('#image_1').height());
//tell the browser what to do when hovering on the div:
$('#image_holder_1').hover(function() {
//when mouse hover:
$('#image_1').animate({
top: '-' + $(this).height() + 'px'
}, /*duration*/2000, /*ease*/'swing');
}, function() {
//when mouse out, no hover:
$('#image_1').animate({
top: '0px'
}, /*duration*/500, /*ease*/'swing');
}); .image_holder {
overflow: hidden; /* not necessary */
}
.image {
position: relative;
} <div id="image_holder_1" class="image_holder">
<img id="image_1" class="image" src="http://bettafootwear.com/CrownYourFeet/wp-content/gallery/released-july-2008/avenger-swamp-white.jpg" />
</div>