Append and animate one at a time. ajax/get callback for a sequential slideDown:
function(htmlString){ $(htmlString).find('.post').each(function(i){ var el = this; setTimeout(function(){ $(el).appendTo('#bodylist').slideDown(500); }, i*500); }); } On May 13, 3:10 pm, Morgan <morganjdavid...@gmail.com> wrote: > Hey, I was wondering how I would be able to convert a string of html > into a series of div elements that I can iterate through and perform > jquery functions on, specifically .hide() and .slideDown(). > > For example, I retrieve a string from a jquery ajax call of html that > looks something like this, > > <div class="post" id="post2918"> > <div class="header"> > Some Text > </div> > <div class="footer"> > Some other text > </div> > </div> > <div class="post" id="post3978"> > <div class="header"> > Some other Text 2 > </div> > <div class="footer"> > Some other text 2 > </div> > </div> > > I want to inject onto the top of a much larger list of post elements > that all have the same class (so I cant just do a search by class). > When I inject them I need to be able to .hide() then .slideDown() each > element individually. I got it working for one element, but it seems > that when there are multiple posts in the returned ajax it gives me > the following error. > > uncaught exception: [Exception... "Could not convert JavaScript > argument arg 0 [nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80570009 > (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame > ::http://localhost:8080/js/jquery-latest.js:: anonymous :: line 871" > data: no] > > So I think I need to somehow traverse through the list of returned > post elements, and perform a .hide() and a .slideDown() on them each > individually. Any help would be appreciated. Thanks.