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 1109661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:16:19+00:00 2026-05-17T02:16:19+00:00

I am trying to animate a table row sliding up, then adding a new

  • 0

I am trying to animate a table row sliding up, then adding a new table row, and animate the new table row sliding down. I have read up on how to animate a table row, now I am trying to queue up these animations.

<table>
    <tr>
        <td><div><a class="trigger" "href="#">Hide this row and add a row after this one</a></div></td>
        <td><div>content</div></td>
        <td><div>content</div></td>
    </tr>
    <!-- new table row will be added here -->
    <tr class="another-row">
        <td><div>content</div></td>
        <td><div>content</div></td>
        <td><div>content</div></td>
    </tr>
    <tr id="new-row" style="display:none">
        <td><div>this row will appear after the row that was clicked</div></td>
        <td><div>content</div></td>
        <td><div>content</div></td>
    </tr>
</table>

Here’s the javascript I have:

$('.trigger').click(function(){

    var $clickedTableRow = $(this).closest('tr');
    var $newTableRow = $('#new-row');

    $clickedTableRow.find('td > div').slideUp('slow', function(){
        alert('animation complete, ready to hide table row');
        $clickedTableRow.hide();
        //however, this executes after each div has finished sliding up, instead of after the last one has finished
    });

});

When I call the slideUp() function, it appears as if each div slides up simultaneously, but the complete function is called after each div instead of once after all of those divs have finished. How can I queue the $clickedTableRow.hide(); function to happen only after all divs have finished? Then once the $clickedTableRow has been hidden, I want to queue up the animation that slides down the new table row:

$newTableRow
    .insertAfter($clickedTableRow)
    .show()
    .find('td > div')
    .slideDown(panelSpeed);

How can I queue up these multiple actions?

  • 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-05-17T02:16:20+00:00Added an answer on May 17, 2026 at 2:16 am

    One possibility is to set a flag that is used to check if the queued code has run.

    Here’s a simple example: http://jsfiddle.net/4J4TY/

    Something like this:

    $('.trigger').click(function(){
    
        var hasRun = false; // determine if queued code has run yet
    
        var $clickedTableRow = $(this).closest('tr');
        var $newTableRow = $('#new-row');
    
        $clickedTableRow.find('td > div').slideUp('slow', function(){
            if( !hasRun ) {
                hasRun = true;
                alert('animation complete, ready to hide table row');
                $clickedTableRow.hide();
            }
        });
    
    });
    

    Now the flag is set to true the first time it runs, so the code inside the if() will only execute once.

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

Sidebar

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.