Created
July 30, 2012 08:30
-
-
Save hengkiardo/3205661 to your computer and use it in GitHub Desktop.
Grow Image when Hover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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