jQuery animate border

落花浮王杯 提交于 2019-12-11 20:05:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!