I just started learning jQuery yesterday and have been, for the past 5 hours, trying to work on a script that is about 90% there. It's the last 10% that's kicking me in the butt.
I have the jQuery library script added as well as User Interface Library (didn't know if I needed that). And this after those calls:
What it does is: 1. On click, the "?" button animates to the right. 2. The "?" button swaps out the background to an "x" 3. Paragraph text fades in. 4. You click on the "x". 5. Paragraph text fades out. 6. The "x" turns back to a "y", but it doesn't go back to the original position! :(
Without thinking too much of this, after including the .active to the item, you should have a if($(this).hasClass("active")) { //Reset animations back to default setting }
I just started learning jQuery yesterday and have been, for the past 5 hours, trying to work on a script that is about 90% there. It's the last 10% that's kicking me in the butt.
I have the jQuery library script added as well as User Interface Library (didn't know if I needed that). And this after those calls:
You can see this in action here: Your text to link...
What it does is:
1. On click, the "?" button animates to the right.
2. The "?" button swaps out the background to an "x"
3. Paragraph text fades in.
4. You click on the "x".
5. Paragraph text fades out.
6. The "x" turns back to a "y", but it doesn't go back to the original position! :(
Grrr... any thoughts? Very appreciated :)
- Steph
if($(this).hasClass("active"))
{
//Reset animations back to default setting
}
inside your click event.
Hopefully that is helpful.
-Vinny
Thank you for responding!
I did try that and it didn't work. I got lucky and found someone else's script that does the job:
What I don't understand is, why did they add function() before the animate? I originally tried this with toggle, but didn't work:
Is there a reason you need a function before each animate?
- Steph
Yeah, that's what the problem was, I didn't know how to move it back lol... :)
- Steph