JSFiddle - React, Tailwind, and code Playground

HTML

<div class="divbox1">
    sdsdsadasdsad<br />
    sadasdsdaasdadsadssdsdsadasasdasdsdsddsasdasdasdasdasddasadsasd<br>
    dasdasasdasdsad
    <br /><br />
    Really Tall box!
</div>
<br /><br />
<div class="divbox1">
    sdsdsadasdsad
</div>

CSS

.divbox1 {
    color: #100;
    background-color: #f9f9f9;
    border: 1px solid silver;
    overflow: hidden;
    width: 200px;
    height:35px;
}

JavaScript

$(".divbox1").hover(function() {
        var height = $(this).height();
        var pad = height + 5;
    
    var height2 = $(this)[0].scrollHeight;
    
    if (height2 > 35)
        {
              $(this).animate({
                     height: height2
                }, 300);
        }
    }, function() {
        $(this).stop(true, false).animate({
            height: 35
        },150);
    });