/    Sign up×
Community /Pin to ProfileBookmark

jQuery fade in/out

Hey guys, quick question..

Here’s the code:

[CODE]<script type=”text/javascript”>
$(document).ready(function(){
$(‘.pda-software’).click(function(){
$(‘#lco-tour-display’).fadeOut(‘fast’);
$(‘#pda-tour-display’).fadeIn(‘slow’);
});

$(‘.lco’).click(function(){
$(‘#pda-tour-display’).fadeOut(‘fast’);
$(‘#lco-tour-display’).fadeIn(‘slow’);
});
});
</script>[/CODE]

Basically, I have two links, one for the pda software, one for lco. When I click the link, I want it to fade in the desired section; however I want it to fade out the other section if it was already clicked.

Is there a way to say something like:

After the #pda-tour-display fades out, THEN fade in lco-tour-display? It seems like they are executing simultaneously.

Hopefully this is an easy one for someone…it’s hard to search on Google for this answer!

Thanks in advance.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Jeff_MottMay 13.2009 — Both the fadeIn and fadeOut methods take a callback to be execute when that animation finishes. So...

$('#lco-tour-display').fadeOut('fast', function(){
$('#pda-tour-display').fadeIn('slow');
});


Give that a try.
Copy linkTweet thisAlerts:
@cbVisionauthorMay 13.2009 — Thanks for the reply. When I changed it, it doesn't work at all now. Here's the copied code:

[CODE]$('#lco-tour-display').fadeOut('fast', function(){
$('#pda-tour-display').fadeIn('slow');
)};[/CODE]
Copy linkTweet thisAlerts:
@Jeff_MottMay 13.2009 — $('#lco-tour-display').fadeOut('fast', function(){
$('#pda-tour-display').fadeIn('slow');
[color=red])}[/color]; [color=green]// &lt;-- this should be }), not )}[/color]
×

Success!

Help @cbVision spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...