astralaaron Posted January 27, 2015 Share Posted January 27, 2015 In my CSS file, my div has a min-height of 600px. The problem I am having is that one of my javascripts needs to know the height of this div, and sometimes, depending on the content, the div will expand beyond 600px. When I try to get the height with javascript, it still says 600px even if it has expanded. Any advice is appreciated! Link to comment Share on other sites More sharing options...
Ingolme Posted January 27, 2015 Share Posted January 27, 2015 The offsetHeight property will tell you the height of the element. Link to comment Share on other sites More sharing options...
astralaaron Posted January 27, 2015 Author Share Posted January 27, 2015 thanks for responding. the problem was the content was inside of a fixed div within the div I was trying to get the height of. Link to comment Share on other sites More sharing options...
Ingolme Posted January 27, 2015 Share Posted January 27, 2015 Your original post says that you wanted the size of the div. The offsetHeight property tells you the vertical size of the div even if it has expanded to contain more content. Since the div expands with the content, its height is also the same as the height of the content that's within it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now