Skip to content Skip to sidebar Skip to footer

JQuery Animate Div Size

I have a div with hidden visibility, and I'm putting text in to that div from database so don't know it's height. What I would like to do is make an animation which would increase

Solution 1:

I don't think you need to mess with the visible CSS property.

Just do something like this in your CSS:

#form_container { display: none; }

Then your display_form function can just do this:

function display_form() {
    $('#form_container').slideDown(1500);
}

Solution 2:

Have a look at the jQuery's slideDown. Then you don't have to worry about the height on your own.


Solution 3:

Not sure how you are getting text from the database but if you initial have the div hidden, then place the text in the div, then you can simple use the slideDown(1000) function on that div like so: $('#mydiv').slideDown(1000); The div will slide down until all the content is shown.


Post a Comment for "JQuery Animate Div Size"