开发者

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

开发者 https://www.devze.com 2023-02-28 20:23 出处:网络
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

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 a开发者_JS百科re 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号