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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:17:22+00:00 2026-05-28T07:17:22+00:00

when animate function will decrease the height & width of div then any other

  • 0

when animate function will decrease the height & width of div then any other function can run parallelly. suppose i want to fadeout my div before it’s height & width becomes 0 zero.
basically i want that when my div’s height & width decrease 50% then i want to make it fadeout. is it possible?

animate has callback but callback will be invoke when animate complete..which i don’t want.
here is sample my animate code

$('#my-id').animate({width: 0, height: 0}, 1000);

if possible then please tell me the solution with sample code. thanks

  • 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-28T07:17:23+00:00Added an answer on May 28, 2026 at 7:17 am

    You can pass a step function to animate(), and it will be called for each step in the animation. In this function, you can set the element’s opacity appropriately as soon as its height reaches half of its original value:

    $("#my-id").animate({
        width: 0,
        height: 0
    }, {
        duration: 1000,
        step: function(now, fx) {
            if (fx.prop == "height") {
                var threshold = fx.start / 2;
                if (now < threshold) {
                    $(fx.elem).css("opacity", now / threshold);
                }
            }
        }
    });
    

    This should behave as you expect and run the two effects in parallel. In passing, note that the resulting fading animation will be more fluid if the element is taller than it’s wide. If your element is wider than it’s tall, you might want to monitor its width property instead of its height.

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

Sidebar

Related Questions

The code like this: $(.hide).click(function(){ $(.online-contact).animate({width: 'toggle',height: '100%'}, fast); $(this).hide(); $(.show-class).show(); }) I want
i have 3 div's & one button <div id=Outer> <div id=main style='height:200px;width:300px'/> <div id=child
$('div').animate({ 'background':'yellow' }, 2000,'linear', function() { }) why?? thanks
I have this jQuery: $(document).ready(function() { $(#panel).hide(); $('.login').toggle( function() { $('#panel').animate({ height: 150, padding:20px
I'm using this jQuery to hide a DIV: $(#slider).click(function() { $(.help).slideToggle(); $(#wrapper).animate({ opacity: 1.0
I am building a page that will animate objects (image/shape/div) and float them around
I'm writing a simple function to animate a div (in this example called 'helpBox').
When I use jQuery animate() function to change the size of a div, it
I have jQuery hover function which a transparent image will animate up. The following
<html> <head> <style type=text/css> div#bg1 { height: 159px; width: 800px; margin-left: auto; margin-right: auto;

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.