Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-24-2010, 06:21 AM   PM User | #1
wldrumstcs
Regular Coder

 
Join Date: Jul 2009
Location: Chicago, IL
Posts: 169
Thanks: 26
Thanked 3 Times in 3 Posts
wldrumstcs is an unknown quantity at this point
prependTo,fadeIn, and slideDown

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!

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

Last edited by wldrumstcs; 10-24-2010 at 03:17 PM..
wldrumstcs is offline   Reply With Quote
Old 10-24-2010, 01:54 PM   PM User | #2
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,827
Thanks: 9
Thanked 685 Times in 679 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
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?
SB65 is offline   Reply With Quote
Old 10-24-2010, 02:39 PM   PM User | #3
wldrumstcs
Regular Coder

 
Join Date: Jul 2009
Location: Chicago, IL
Posts: 169
Thanks: 26
Thanked 3 Times in 3 Posts
wldrumstcs is an unknown quantity at this point
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.
wldrumstcs is offline   Reply With Quote
Old 10-24-2010, 02:45 PM   PM User | #4
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,827
Thanks: 9
Thanked 685 Times in 679 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
That's what slideDown does, unfortunately. Is there any reason not to just use fadeIn and remove the slideDown entirely?
SB65 is offline   Reply With Quote
Old 10-24-2010, 03:05 PM   PM User | #5
wldrumstcs
Regular Coder

 
Join Date: Jul 2009
Location: Chicago, IL
Posts: 169
Thanks: 26
Thanked 3 Times in 3 Posts
wldrumstcs is an unknown quantity at this point
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.
wldrumstcs is offline   Reply With Quote
Old 10-24-2010, 03:12 PM   PM User | #6
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,827
Thanks: 9
Thanked 685 Times in 679 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
Have a try with:

Code:
$(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.
SB65 is offline   Reply With Quote
Users who have thanked SB65 for this post:
wldrumstcs (10-24-2010)
Old 10-24-2010, 03:16 PM   PM User | #7
wldrumstcs
Regular Coder

 
Join Date: Jul 2009
Location: Chicago, IL
Posts: 169
Thanks: 26
Thanked 3 Times in 3 Posts
wldrumstcs is an unknown quantity at this point
That works! Thank you so much!!
wldrumstcs is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:13 AM.


Advertisement
Log in to turn off these ads.