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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:11:08+00:00 2026-05-29T19:11:08+00:00

I have created a quick jsfiddle here showing it not working. The problem I

  • 0

I have created a quick jsfiddle here showing it not working.

The problem I have is with the slide up. I want it to work so that it only sets the width to 0 after the slideup has finished. The obvious callback function does not seem to be getting called after the slideup has finished.

I would like it to work like this:

  1. Shows the red box by sliding down and increasing the width together.
  2. Click again and the box slides up then sets the width the 0. So that if the user clicks the button again the first animation would appear the same.

    var $foo = $(“#elm”);

    $("#btn").toggle(function() {
        showDropDown();
    }, function() {
        hideDropDown();
    });
    
    function showDropDown(){
        $foo.slideDown({duration:500, queue:false}).animate({"width": 400}, 250);
    }
    
    function hideDropDown(){
        $foo.slideUp({duration:800, queue:false},function(){
            $foo.css({"width": 0});
        });            
    }
    

UPDATE:
The strange thing is that if I add a alert() into the callback function for slidedown it never gets called.

  • 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-29T19:11:09+00:00Added an answer on May 29, 2026 at 7:11 pm

    Edit: Sorry for the first answer, didn’t pay attention.

    The problem is that the callback is not executed, because you don’t give the parameters according to the API, and the callback is not “wired” in.

    Instead, you can use the promise().done(...) combination to achieve the objective you wanted.

    So, you should modify your hideDropDown method as follows:

    
    function hideDropDown(){
        $foo.slideUp({duration:800, queue:false}).promise().done(function(){
            $foo.css("width", "0px");
        });            
    }
    

    From the jQuery docs:

    “The .promise() method returns a dynamically generated Promise that is resolved once all actions of a certain type bound to the collection, queued or not, have ended.”

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

Sidebar

Related Questions

I have a quick question regarding memory management that I am not quite sure
I have created a quick and simple plugin that vertical aligns images that I
So I have created a CSS3 animation that does not behave consistently across the
I have created a PHP-script to update a web server that is live inside
I have created a UserControl that has a ListView in it. The ListView is
I have created a few small flash widgets that stream .mp3 audio from an
i have created a workflow activity that do give the item creater of a
On my venture for quick rendering within Flash, I've worked out that the only
I created this quick jsfiddle project to help you help me. Why does margin-top
Could you please have a quick look at the sample code http://jsfiddle.net/vXvs2/ I don't

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.