Skip to content

Instantly share code, notes, and snippets.

@hengkiardo
Created July 30, 2012 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hengkiardo/3205661 to your computer and use it in GitHub Desktop.
Save hengkiardo/3205661 to your computer and use it in GitHub Desktop.
Grow Image when Hover
function growImage() {
$('a.idea-link').each(function () {
var oheight = $(this).children(0).height();
var owidth = $(this).children(0).width();
var nheight = (oheight + (oheight * 0.25));
var nwidth = (owidth + (owidth * 0.25));
var top = ((oheight - nheight) / 2);
var left = ((owidth - nwidth) / 2);
$(this).mouseenter(function () {
$(this).css('z-index', '2').children(0).css('z-index', '3').stop().animate({
'height': nheight + 'px',
'width': nwidth + 'px',
'left': top + 'px',
'top': left + 'px'
}, 210);
});
$(this).mouseleave(function () {
$(this).children(0).css('z-index', '1').stop().animate({
'left': '0px',
'top': '0px',
'height': oheight + 'px',
'width': owidth + 'px'
}, 150, function () {
$(this).css('height', oheight + 'px').parent().css('z-index', '1');
});
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment