In the following code the last line doesn’t work in my way:
$('button.goal').click(function () {
$('div.scorer_away').animate({
width: 'hide',
opacy: 'hide'
}, 'slow')
.delay(2500)
.animate({
width: 'show',
opacy: 'show'
}, 'slow');
$('span.scorer_away').delay(3000).prepend('<img src="chofbauer.png" alt="" />');
How can I make it work, that the prepend()-function adds the new image AFTER 3 sec (because after 2,5 sec the container, where the img prepends is hidden)?
.delay()only works with jQueryfx methods..prepend()is not one of those.You can workaround it like
Actually you would have to create your own .queue() for a “clean” solution.
Another way to accomplish that task is to use javascripts native
setTimeout().