css check if element is overflowing code example
Example 1: jquery detect if element has overflow
if ($("#myoverflowingelement").prop('scrollWidth') > $("#myoverflowingelement").width() ) {
}
if ($("#myoverflowingelement").prop('scrollHeight') > $("#myoverflowingelement").height() ) {
}
Example 2: javascript check if element is overflowing
function checkOverflow(el)
{
var curOverflow = el.style.overflow;
if ( !curOverflow || curOverflow === "visible" )
el.style.overflow = "hidden";
var isOverflowing = el.clientWidth < el.scrollWidth
|| el.clientHeight < el.scrollHeight;
el.style.overflow = curOverflow;
return isOverflowing;
}