开发者

On image mouseover zoom

开发者 https://www.devze.com 2023-03-21 23:43 出处:网络
Here is my jQuery code.. $(\'img\').live(\'mouseenter\',function() { $(t开发者_运维百科his).addClass(\'shown\');

Here is my jQuery code..

 $('img').live('mouseenter',function()
          {  
              $(t开发者_运维百科his).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'});
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号