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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:54:47+00:00 2026-06-03T22:54:47+00:00

I know this has been asked a few times around here but most of

  • 0

I know this has been asked a few times around here but most of the answers didn’t solve for the case where one could consistently append information and the box was visible to begin with (and I don’t know the new height I would like to animate to (because its text im adding))

Say I have a div and I append text to it how would I animate it

<div id="mybox">
Text
</div>

Javascript code (JQuery library is used)

function appendAndAnimate(text)
    $('#mybox').append(text +"<br/>")
end

I want to call this a couple of times and not have it jerk to the new height but slowly expand to it. (The box isn’t hidden to begin with or anything).
I’ve tried -webkit-transition and transition to no avail. I’ve also played around with capturing the height before and after and shifting it back and forth but theres no elegance here and its more a dirty solution

Because its text I wouldn’t like to use a flat on add a height with animation to the div box because people may have different font-scaling set on their browsers.

  • 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-03T22:54:49+00:00Added an answer on June 3, 2026 at 10:54 pm

    As I understood you want to make animation of mybox when you append text. I can see it like adding a new block of text into mybox and showing it with slideDown animation as an example. Then it will look like that:

    $("button").click(function() {
        var el = $("<div />").css("display", "none").text("New Text")
        $("#mybox").append(el);
        el.slideDown(1000);
    });​
    

    DEMO: http://jsfiddle.net/YRuqP/


    UPDATE. In fact I have even better solution. If you don’t want to add blocks of text. You can use another variant. Here we need to add one extra block inside mybox, so the markup will look like this:

    <div id="mybox">
        <div>
            Text
        </div>
    </div>
    

    And set to mybox style overflow: hidden.

    Then we can update the code a bit to have nice sliding animation when any piece of text is inserted.

    var block = $("#mybox");
    var child = block.children();
    block.css("height", block.height());
    
    $("button").click(function() {
        child.append(text);
        block.animate({
            height: child.height()
        });
    });​
    

    DEMO: http://jsfiddle.net/YRuqP/1/

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

Sidebar

Related Questions

I know this has been asked a few times here. But none of the
I know this question has been asked here a few times before. But i
I know this questions has been asked a few times here. But these seem
I know this has been asked a few times but none of the answers
I know this has been asked before but all the answers I found didn't
Now I know this has been asked a few times, but i'm still not
I know this has been asked a few times, but I can't find a
I know this has been asked a few times but please bear with me.
I know this kind of question has been asked a few times, but alot
I know this has been asked a few times before, but the existing solutions

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.