Jump to content

jQuery height() issue


kvnmck18

Recommended Posts

I'm using jQuery to load() external content that has a wrap() that will fadeIn() as a <div/> overlay. I am trying to get the height() of this wrap but it's coming up as "0".If I give it a fixed height in css it works -- BUT -- I can't give it a static height because the height needs to be relative to the content within (from the external file).I'm not sure how to fix this... It might be because the script is reading the "height" before the external content is actually loaded... but I'm not sure how to no make this happen.Suggestions? Has any dealt with this issue?

Link to comment
Share on other sites

Here's an example I saw of someone else that was having the same issue (this is how you can easily reproduce the error)

				var x = $("<span>sjdafklasdjfljsdalf<br/><br/>dsfasdfasdf</span>").css('height', 250); 				x.height(); //0 				x.css("height"); //250px 				alert(x.height()+"   "+x.css("height"));

The height should not be zero but the height of all those lines of "content". How can I show the height()?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...