Jump to content

jQuery height() issue


kvnmck18
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...