0

Is it possible to open div smoothly to full size of its content? If:

  1. content of the div - text of any size
  2. div initially displays some of the text ({overflow:hidden; height: 100px;})

It should be crossbrowser solution, appearance of scrollbar is unacceptable.

Thanks.


Here is the solution thanks to @Tryster.

glagola
  • 2,142
  • 3
  • 17
  • 20

3 Answers3

5

you can do it with jquery

$("#your_div_name").show('slow');

or

$("your_div_name").slideDown('slow');
Binil
  • 6,445
  • 3
  • 30
  • 40
  • Nope, div is visible, but it shows a part of his content (via `{overflow:hidden; height: 100px;}`). I want to increase height of the div smoothly until div began to show all of his content. – glagola Jul 23 '11 at 07:19
  • say your parent dive name is `divParent` and insert a div inside the `divParent` say `your_div_name` and do the same.. :) – Binil Jul 23 '11 at 07:22
1

I seem to remember the scrollHeight property of an element should return the length of the content. You could then use this to call jQuery.animate on the height.

Tryster
  • 199
  • 2
0

http://jsfiddle.net/efortis/vxS6y/

 $('.smooth').slideUp(350).delay(800).fadeIn(400);
Eric Fortis
  • 16,372
  • 6
  • 41
  • 62