...

View Full Version : Resolved prependTo,fadeIn, and slideDown



wldrumstcs
10-24-2010, 06:21 AM
I am attempting to prepend a div to another div. I want the div's elements to slide down, and then have the newly prepended element faded in. Here's what I have, but it's not working.

Thanks!



$(xmlhttp.responseText).hide().prependTo("#new_ideas").slideDown("slow").fadeIn("slow");

SB65
10-24-2010, 01:54 PM
In what way is it not working?

The slideDown() function will make the new element appear - so the subsequent fadeIn() will have no effect - is that the problem?

wldrumstcs
10-24-2010, 02:39 PM
Yes. The new element isn't fading in, which is what I'm trying to do. I don't want slidedown to automatically show the new element.

SB65
10-24-2010, 02:45 PM
That's what slideDown does, unfortunately. Is there any reason not to just use fadeIn and remove the slideDown entirely?

wldrumstcs
10-24-2010, 03:05 PM
I would like to keep both (even if I have to hack it to work correctly). I like the animation of the current contents sliding down to make room for the new element, and then the new element fading into view.

SB65
10-24-2010, 03:12 PM
Have a try with:


$(xmlhttp.responseText).hide().prependTo("#new_ideas").css({opacity:0}).slideDown("slow").animate({opacity:1},"slow");

Setting the opacity to 0 before the slideDown allows the element then to be faded in with animate.

wldrumstcs
10-24-2010, 03:16 PM
That works! Thank you so much!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum