0

I'm creating multiple elements and adding them to the DOM. As I add them the height of the container grows based on the height of the items being added. All the items being added are the same, based off of a CSS class. I would like to set the height of the container DIV before the individual items are added, as they are delayed by an ajax call.

Is there a way to get what the item height will be from the CSS class definition itself rather than having to wait to read it from an element in the DOM?

Justin808
  • 20,859
  • 46
  • 160
  • 265
  • How do you do that? Can't you just modify your insert function to first get the image with ajax, save it to variable, get height of that variable, add it to container, and then render/add that variable(image) into dom? – Damb Apr 25 '11 at 20:15

1 Answers1

2

The short answer I would assume to be, No.

But you could have a div element hidden off the screen that your content loads into and then get the height of that element. When the height is pulled you then move the content to your final area.

Seth
  • 6,240
  • 3
  • 28
  • 44
  • you could try to parse the CSS file, but i would say there are better ways of achieving what you're trying to do, yes. – Jason Apr 25 '11 at 20:22