views:

60

answers:

1

Hi guys, I have such code:

$('div.new_menu').hover(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?

+7  A: 

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); 
   });
rahul
oh cool I didn't know you could do that!
Pointy
Thank you for answer.
Ockonal