Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8131547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:07:23+00:00 2026-06-06T09:07:23+00:00

How do I get a function to run after all the fadeOuts in the

  • 0

How do I get a function to run after all the fadeOuts in the for loop below?

What I need to do is fadeout anything that may be visible and then fadein a specific object. Due to styling requirements my topnav and dropdown nav are in to different uls which is why things are tricky.

I’m not very good at writing my own scripts yet so I’m (hopefully) missing something basic.

I’ve tried wrapping things in functions but that seems to mess with variable scope and screws things up that I don’t understand…

Thanks for any help!

$('.ksddtop').on('mouseenter', function(){
    var ddtop = $(this).text();
    var dd = $('.' + ddtop);
    $('.ksddwrap').fadeIn();
    $(dd).fadeIn();

    var ksdds = $('.ksdd');
    for(var i = 0; i < ksdds.length; i++) {
        var ksdd = ksdds[i];
        if (! $(ksdd).hasClass(ddtop) ){
            $(ksdd).fadeOut();
        }
    }
}); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:07:25+00:00Added an answer on June 6, 2026 at 9:07 am

    This should do it, if I understand the requirements:

    $('.ksdd:not(' + ddtop + ')').fadeOut().promise().done(function(){
        // all done fading!
    });
    

    Fade out all ksdd elements that don’t have the ddtop class, then do something when they are all done animating.

    More Information:

    calling .promise on a jQuery collection gives you a promise object that will resolve when all animations on the collection of elements are complete. This includes queued animations.

    If you instead passed a callback function directly to .fadeOut(), you would get a callback for each element rather than one after they were all done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From a function that i run in matlab i get a 225x400 matrix. I
If I run the function below before defining it, I will get this error...
I need some code to run in a component after all the sizes of
For example, select * from x where crc=CRC32('Hi') does the CRC32 function get run
How do I get this function to not only run on window resize but
I use onEdit to run a function but I can get how to address
I am trying to get my Chrome Extension to run the function init() whenever
I've got a particular function I want to run once, and only after the
Update, Solved: After all this I found out that I was calling an old
Below is my RUN_SQL function: def RUN_SQL_SAFE(sql, input_tuple=(), get_update_id=False, debug = False): conn =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.