JQuery Question
- Started
- Last post
- 5 Responses
- nosaj
I'm trying to figure out how to have multiple animations with different durations occur simultaneously on the same element.
For example
1) I want an element to slide left 1000 over 10 seconds.
2) During the 1st 2 seconds of the slide in I want the opacity to animate from 0 to 1.
3) During the last 2 seconds I want the opacity to animate from 1 to 0.Basically having an object sliding left to right fade in and fade out while sliding.
This seems to cover the 1st 2 steps, any suggestions on how to trigger the last fadeout?
$("#something")
.animate({opacity: 1, queue: false}, 2000)
.animate({left: 1000 +"px", queue: false}, 10000);
- mekk0
Use the step function:
http://api.jquery.com/animate/
- kingsteven0
you're actually nearly right nosaj, just fucked up your syntax a bit... you dont need step... just like this:
- nosaj0
Thanks Kingsteven - If I want a delay before it fades out at the end is there a cleaner way to do it than this?
- dbloc0
add .delay(10000)