Justin808
Justin808

Reputation: 21512

Getting the height from CSS, not from an element in the DOM

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?

Upvotes: 0

Views: 195

Answers (1)

Seth
Seth

Reputation: 6260

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.

Upvotes: 2

Related Questions