问题
I have a problem animating border-top-left-radius style. I use this style by entering two length values separately.
border-top-left-radius: 15px 25px;
I would like to increase these two length values separately via jquery.animate().
Is there a way to achieve this?
回答1:
border-top-left-radius accepts just one value right? So you would animate it like:
$('.class').animate({borderTopLeftRadius: 20})
EDIT
Not sure if jQuery supporst this out of the box. Maybe you can implement the step callback like this:
$('#container').animate({
borderTopLeftRadiusSideLength: 500,
borderTopLeftRadiusUpperLength: 50
}, {
duration: 5000,
step: function (val, context) {
$(this).data(context.prop, val);
var side = $(this).data('borderTopLeftRadiusSideLength');
var upper = $(this).data('borderTopLeftRadiusUpperLength');
if (side && upper) {
$(this).css('borderTopLeftRadius', side + 'px ' + upper + 'px');
}
}
});
http://jsfiddle.net/YWsQn/1/
来源:https://stackoverflow.com/questions/13551857/jquery-for-animating-border-radius