Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.