开发者

JQuery animation in IE

开发者 https://www.devze.com 2022-12-27 20:52 出处:网络
I have such code: $(\'div.new_menu\').h开发者_开发技巧over(function(){ $(this).stop(false, true).animate({width: $(this).width() + 25}, 450);

I have such code:

$('div.new_menu').h开发者_开发技巧over(function(){ 
      $(this).stop(false, true).animate({width: $(this).width() + 25}, 450); 
   },function(){ 
      $(this).stop(false, true).animate({width: $(this).width() - 25}, 450); 
   });

It works perfect in all browsers except IE. Could you help me with rewriting it to JavaScript?


Try giving the first parameter to stop() as true. Also change the width as relative

Animated properties can also be relative. If a value is supplied with a leading += or -= sequence of characters, then the target value is computed by adding or subtracting the given number from the current value of the property.

$('div.new_menu').hover(function(){ 
      $(this).stop(true, true).animate({width: '+=25'}, 450); 
   },function(){ 
      $(this).stop(true, true).animate({width: '-=25'}, 450); 
   });
0

精彩评论

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

关注公众号