问题
Hi I am trying to animate the border of an input but no matter how I put the border it just doesn't seem to animate.
My current code:
$(this).animate({border : '1px solid #f00'}, 'slow', 'linear');
回答1:
You have to set the border color and style css properties In full jquery :
$(this).css({borderColor:"#f00",borderStyle:"solid"}).animate({borderWidth : '3px'}, 'slow', 'linear');
You need plug-in for animate border color in jquery, check this : http://www.bitstorm.org/jquery/color-animation/
Then..
$(this).animate({borderColor: '#f00'});
Maybe that's could help someone...
回答2:
You need to animate one parameter at a time.
border-width : '1px'
or
border-color : '#f00'
来源:https://stackoverflow.com/questions/10883545/jquery-animate-border