Jquery onmouseover图像大小增加 [英] Jquery onmouseover image size increase

查看:92
本文介绍了Jquery onmouseover图像大小增加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试做一个效果,当鼠标悬停在图像上时,它会变大50%的大小,并在鼠标移出其区域后立即返回。可以用jquery做到这一点吗?怎么样?没有jquery可以做到这一点吗?没有jquery这么做会有多难?

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?

推荐答案

你走了:

$('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)
    });
});

现场演示: http://jsfiddle.net/simevidas/fwUMx/5/

这篇关于Jquery onmouseover图像大小增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆