Check if an element’s content is overflowing?

The element may be overflown vertically, horizontally or both. This function will return you a boolean value if the DOM element is overflown:

function isOverflown(element) {
  return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;

Leave a comment

Your email address will not be published. Required fields are marked *