jQuery 1.4.2’s animate() API spec is
.animate( properties, [ duration ], [ easing ], [ callback ] )
but it seems that we can supply duration, callback, and no easing
.animate({left: '+= 100'}, 600, doThis)
and it will work.
But if we supply easing and callback and no duration
.animate({left: '+=100'}, 'swing', doThis)
then the easing won’t be taken into effect. So what exactly is the API supposed to be?
Update: please see my answer below.
Normally jQuery determines optional parameters by types, e.g. this works:
But in the case of duration/easing, since they’re both strings it can’t (and if there’s a single string, it assumes it’s the duration). You need to either call it with
'normal'as the duration, like this:Or use the
.animate(options, properties)version, like this: