I'm trying to determine whether some content fits within its max-height limit but the line-height
affects the result, in a way that I don't understand.
Here is my code to compute whether or not the content is partially hidden:
var partiallyHidden = content.scrollHeight > content.offsetHeight;
But it seems like I have to factor in other aspects such as line-height
because depending on the line-height of the content, this code does not work.
See this full example here: http://plnkr.co/edit/mdI6pGRRWHtS0KXvQOX6?p=preview
What is the relationship between line-height and scrollHeight/scrollOffset? And are there other aspects I have to consider?
By the way, my solution has to work with IE9+.
Other notes:
- I found the
content.scrollHeight > content.offsetHeight
formula in another SO question. - The code provided in the accepted answer to this question yields the same error. (
el.clientHeight < el.scrollHeight
). I'm not sure howclientHeight
vsscrollOffset
changes the result.