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

  • SEARCH
  • Home
  • 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 8386779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:02:01+00:00 2026-06-09T18:02:01+00:00

this is my code snippet. function customFadeIn () { $(img.imgKit).each(function(index) { $(this).delay(1000*index).fadeIn(slow); }); console.log(one

  • 0

this is my code snippet.

    function customFadeIn () {
    $("img.imgKit").each(function(index) {
        $(this).delay(1000*index).fadeIn("slow");
    });
    console.log("one runs");
}

function customFadeOut () {
    $("img.imgKit").each(function(index) {
        $(this).delay(1000*index).not(document.getElementById('card-6')).fadeOut("slow" , function () {
            $("#card-6").delay(1000).rotate({angle:0});
        });
    });
    console.log("two runs");
}

I want the customFadeOut runs only after customFadeIn is done, therefore I call it by this

customFadeIn();
customFadeOut();

But it did not work, I think I did something wrong here, a help would be really helpful.

  • 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-09T18:02:03+00:00Added an answer on June 9, 2026 at 6:02 pm

    You can make usage of jQuerys Deferred / promise objects. Animations do also “inherit” those objects and you can apply jQuery.when() to shoot for multiple promises to finish.

    There are several ways to re-structure your code for that, a simple implementation of this could look like:

    (function() {
        var promises = [ ];
    
        function customFadeIn () {
            $("img.imgKit").each(function(index) {
                 promises.push( $(this).delay(1000*index).fadeIn("slow").promise() );
            });
        }
    
        function customFadeOut () {
            jQuery.when.apply( null, promises ).done(function() {
                $("img.imgKit").each(function(index) {
                    $(this).delay(1000*index).not(document.getElementById('card-6')).fadeOut("slow" , function () {
                        $("#card-6").delay(1000).rotate({angle:0});
                    });
                });
                console.log("two runs");
            });
        }
    }());
    

    If I did everything correct there, customFadeOut sets up a listener which waits for all animations / promises to finish, before it runs its own code. You don’t even have to explicitly call the .promise() method at the end, jQuery applies some white magic to link that node with a promise internally for you.

    Demo: http://jsfiddle.net/RGgr3/


    Looks like I did everything correct 😉

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

Sidebar

Related Questions

Please consider this code snippet: var ul = $(.list_b).find(li).remove().end(); $.each(Sites, function (index, value) {
Look at this code snippet: $('#clickme').click(function(){blinkText($('#SendedText')); }); function blinkText(element) { $(element).fadeIn('slow'); $(element).fadeOut('slow'); } http://jsfiddle.net/aXMtH/5/
I have this code snippet: $(function() { $('.toolbar [id^=button]').on('click', function () { $(this) .css('background-color',
I have this code snippet inside a function that checks if an object exists
I'm looking at this code snippet: var addSnippet = function( req, res ) {
I have a similar code snippet like this class Search { public function search($for,
So i got this snippet of code: $(document).ready(function () { var replacementDoneIn = $(body).html();
I do not understand this code snippet : function ms(){ var plc=unescape('. unescape( '\x43\x43\x43\x43\n.............\xEF'.
Consider this code snippet: transaction.executeSql( 'SELECT * FROM pv_master;', [], function(transaction, result) { if(result.rows.length
he guys... i use this litte code-snippet for jquery: function updown() { $('#red').animate({top:'+=100'}, 5000,

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.