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?

1
  • 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? Commented Apr 25, 2011 at 20:15

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.