I expect when I go
$.each($(something).find(something), function(){ $(this).delay(1000).fadeOut(); });
then for each matching element I get a second delay until it disappears. but what I get is a second of delay, and then it all disappears. its 3am and i cant think. please, help
This will work, call it using the jQuery object as a parameter:
function fadeAll(elems) { var i=-1; function next() { i = i+1; if (i < elems.length) $(elems[i]).delay(1000).fadeOut(next); } next(); }
You can see it at work here .
, , ? , $(this).fadeOut(1000);, ; delay(1000) , fadeOut().
$(this).fadeOut(1000);
delay(1000)
fadeOut()
This should be the main idea:
var set = $(something).find(something); var delayFade = function(){ $(this).delay(1000).fadeOut(400, nextDelayFade); }; var i = 0; var nextDelayFade = function() { if(i < set.length) { $(set[i++]).each(delayFade); } }; nextDelayFade();
Source: https://habr.com/ru/post/1740615/More articles:How to search from a list with keywords without a prefix - c #https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1740611/rails-how-can-i-combine-multiple-model-attributes-to-create-a-unique-permalink-using-permalinkfu&usg=ALkJrhgU4cg2OiIu90YKfq0ie9iV7k1oKgHow can I put an image in a row using NSString on an iPhone? - iphoneSquare number in NASM assembly without multiplication - assemblyHow to create a runtime protocol in Objective-C? - objective-cEasy loading of flash objects - javascriptMinGW error "undefined reference to 'typeof' '" - cDistributed message distribution - architectureApp Engine - Objectify - saving byte [] - google-app-engineFailed to execute DBD :: SQLite :: st: data mismatch - perlAll Articles