So, I would like an element to fade in and wait half a second, then fade the next in etc...
My code:
$('.comment').each(function() {
$(this).css({'opacity':0.0}).animate({
'opacity':1.0
}, 450).delay(500);
});
I'm obviously doing something really silly.... (I hope)... My question is: Is this even possible? if not - can anyone point me in the right direction?
Thanking you!
jQuery | delay() with ExamplesThe delay() is an inbuilt method in jQuery which is used to set a timer to delay the execution of the next item in the queue. para1: It specifies the speed of the delay. para2: It is optional and specifies the name of the queue.
To delay a function call, use setTimeout() function. functionname − The function name for the function to be executed. milliseconds − The number of milliseconds. arg1, arg2, arg3 − These are the arguments passed to the function.
The delay () is an inbuilt method in jQuery which is used to s et a timer to delay the execution of the next item in the queue. para1: It specifies the speed of the delay. para2: It is optional and specifies the name of the queue. Return Value: It returns the selected element with the specified speed. In the below code, timer is set ...
The delay() is an inbuilt method in jQuery which is used to set a timer to delay the execution of the next item in the queue. Syntax: $(selector).delay(para1, para2); Parameter: It accepts two parameters which are specified below-para1: It specifies the speed of the delay. para2: It is optional and specifies the name of the queue.
The .delay () method is best for delaying between queued jQuery effects. Because it is limited—it doesn't, for example, offer a way to cancel the delay— .delay () is not a replacement for JavaScript's native setTimeout function, which may be more appropriate for certain use cases.
The syntax for this function is ‘ ($selector). delay (speed.name), where speed.name represents the delay value and name is an optional parameter used to title this function in the execution queue.
Or, something like this:
$.each($('.comment'), function(i, el){
$(el).css({'opacity':0});
setTimeout(function(){
$(el).animate({
'opacity':1.0
}, 450);
},500 + ( i * 500 ));
});
demo => http://jsfiddle.net/steweb/9uS56/
try something like this
$(this).find('#results').children().each(function(index){
$(this).delay(500 * index).slideDown(500);
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With