0

I would like to automatically go through several screen sizes and check if the button size is too small for the text inside if it so the text goes outside of the button. So far i get only a size of the button itself. Is there any way i can get actual size of the text on the page?

1 Answers1

0

compare the scroll-dimensions (scrollWidth, scrollHeight) to the offset-dimensions. If scroll exceeds offset, your content takes more space than the container.

function isOverflowing(node){
    return node.scrollWidth > node.offsetWidth || node.scrollHeight > node.offsetHeight
}
Thomas
  • 3,513
  • 1
  • 13
  • 10