JSFiddle - React, Tailwind, and code Playground

by andrew rowe

HTML

<div id='i'>
     <h3>title</h3>

    <button id='b'>Press me</button>
</div>

CSS

#i {
    border: 2px solid yellow;
}

JavaScript

$('#b').click(function (evt) {
    $(this).parent().hide('slow').delay(200).slideDown().fadeOut('slow').fadeIn('slow');
    var interval = setInterval(function () {
        var h3 = $('#i h3');
        var l = h3.offset().left;
        h3.css({ position: 'absolute',
            left: l + 10
        });
        h3.html(h3.offset().left);
        if( h3.offset().left > $('#i').offset().right ){
            clearInterval(interval);
        };
    }, 100);
})