I’m using jQuery to animate DOM element on the page and I hit an obstacle when using its native animate()
.
I’m trying to move my element to the right and change its opacity.
$element.animate({
'left': '50%',
'opacity': '1.0'
}, 1000);
It works very well, but I need to animate position in 1000
ms and opacity in 300
ms.
I found out that I can’t write it like this:
$element.animate({
'left': '50%'
}, 1000);
$element.animate({
'opacity': '1.0'
}, 300);
This will result in queued animation, because it is the same element and jQuery apparently needs to wait for the first animation to finish. Or I’m doing something wrong here.
I tried using second argument notation (based on http://api.jquery.com/animate) and using queue: false
but it didn’t work. I must say I don’t understand it thoroughly, so any corrections are welcome.
So my question is this – how to independently change duration interval for these CSS properties?