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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:41:05+00:00 2026-05-22T22:41:05+00:00

Here is the function I have written $(‘#move’).bind(‘tap’, function () { $(‘.page’).addClass(‘slideLeftOut’, function ()

  • 0

Here is the function I have written

$('#move').bind('tap', function () {
    $('.page').addClass('slideLeftOut', function () {
    $('#wrapper').css("height","300");
    }); 
}); 

My problem is, I need the #wrapper’s height to change to 300 AFTER the addClass..

I thought that this was the correct syntax for this, but it does not change the height after the addClass function.

Any Advice?

EDIT:

Here is a JSfiddle:
http://jsfiddle.net/TSM_mac/A8T9f/

  • 1 1 Answer
  • 3 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-22T22:41:06+00:00Added an answer on May 22, 2026 at 10:41 pm

    The normal jQuery addClass method does not take a callback function. It does not return until the operation is complete, so you can safely put the code on the following line:

    $('#move').bind('tap', function () {
        $('.page').addClass('slideLeftOut');
        $('#wrapper').css("height","300");
    });
    

    Since you are using jQuery UI, however, this is a little trickier. The jQuery UI extension to addClass does not provide a callback argument.

    Since the UI addClass method uses animate internally, you could use the jQuery 1.6 $.Deferred enhancement, which allows you to call functions when all animations on an element are complete. This is easy to implement with promise:

    $('#move').bind('tap', function () {
        $('.page').addClass('slideLeftOut').promise().done(function() {;
            $('#wrapper').css("height","300");
        });
    });
    

    See:

    • $.Deferred
    • $.fn.promise
    • deferred.done

    Note that this will only run when all animations are complete, not just the addClass one.


    If you are using a browser’s native animation capacity, I don’t believe there is any easy way of finding out when an animation is finished. You’ll need to do use setTimeout to run the code after a specified period of time.

    See jsFiddle:

    $('.page').addClass('slideLeftOut');
    
    setTimeout(function() {
        $('#wrapper').css("height","300");
    }, 500);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a simple function: function inputChanged() { $('input').change(function(){ $(this).addClass('changed'); }); } I
Here is the code I have written: function p_deal(id) { var card1_val = Math.floor(Math.random()
Here's my issue: I have written a function to detect if a string is
Is it possible to have default arguments in MATLAB? For instance, here: function wave(a,
I have the function prototype here: extern C void __stdcall__declspec(dllexport) ReturnPulse(double*,double*,double*,double*,double*); I need to
I have this simple function: <script type=text/javascript> //<![CDATA[ jQuery(function($){ function here(b){alert(b);} ; here(6); });
Just a little confused here... I have a function in postgres, and when I'm
In python, you can have a function return multiple values. Here's a contrived example:
We have system here that uses Java JNI to call a function in a
Okay here's the program I have typed up(stdio.h is included also): /* function main

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.