JQuery animation in IE
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);
});
精彩评论