Giberno Giberno - 9 months ago 13
Javascript Question

How to get div height after the action slider down or slider up?

Code in here: jsfiddle Demo

I wanna to get the

height when it finish the action of
slider down/up

For example, in demo, I type some words, they make the div height is
, so if I click
slider down
, I need get the value
, and if I click
slider up
, I need return the value
. Thanks.


Then, but it in the callback function of the slideDown or slideUp, for example like:

 $('#content').slideDown('slow', function(){
        var height = $(this).height();


Notice that it will give you the same height 38 in the two cases the slideDown and the slideUp, becouse the two functions don't change the height property of the div, but only the display proprty from none to block, so the div #content's height property is the same after slideing down as it's height before.