Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery onmouseover image size increase

I am trying to do an effect where when the mouse hovers over an image the it grows large by 50% of its size and goes back as soon as the mouse moves out of its region. Can it be possible to do this with jquery? how? could it be possible to do this without jquery? how hard would it be to do it without jquery?

like image 955
Vish Avatar asked May 18 '26 23:05

Vish


1 Answers

Here you go:

$('img').load(function() {
    $(this).data('height', this.height);
}).bind('mouseenter mouseleave', function(e) {
    $(this).stop().animate({
        height: $(this).data('height') * (e.type === 'mouseenter' ? 1.5 : 1)
    });
});

Live demo: http://jsfiddle.net/simevidas/fwUMx/5/

like image 106
Šime Vidas Avatar answered May 21 '26 11:05

Šime Vidas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!