图像上的鼠标悬停缩放 [英] On image mouseover zoom

查看:59
本文介绍了图像上的鼠标悬停缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的jQuery代码.

Here is my jQuery code..

 $('img').live('mouseenter',function()
          {  
              $(this).addClass('shown');
              $('.shown').animate({width: '+=50',height: '+=50'})
          });

 $('img').live('mouseleave',function()
          {
              $(this).removeClass('shown');
              $(this).addClass('reset');
               $('.reset').animate({width: '-=50',height: '-=50'})
          });

某些鼠标进入后,它正在删除图像..请帮助我..

It is removing the image after some mouse enters.. Please help me..

推荐答案

您正在选择要进行动画处理的图像,而不是需要进行的复杂处理:

You are making selection of the image to animate more complicated than it needs to be:

$('img').hover(
    function () { 
        $(this).animate({width: '+=50', height: '+=50'});
    },
    function () {
        $(this).animate({width: '-=50', height: '-=50'});
    });

这篇关于图像上的鼠标悬停缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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