JSFiddle - React, Tailwind, and code Playground

by muss

HTML

<div>
   <table>
    <thead>
    <tr>
        <th> Lorem ipsum  </th>
        <th> adhuc maiestatis </th>
    </tr>
    </thead>
        <tr>
        <td> dolor sit amet, meis solum eam ea, e  </td>
        <td> has ea, alii ipsum necessitatibus ex qui.   </td>
    </tr>
</table>
</div>

CSS

table { border : 1px solid red; white-space: nowrap; width: 100%;}
div { border: 1px dashed blue; padding: 10px; overflow: auto; }

JavaScript

window.onresize = function() { 
         if ( $("div").outerWidth() < $("div").get(0).scrollWidth ) {
             console.log("foo bar scrollbar");
         } else {
             console.log(" no scrolling :)  ");
         }
     };