JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
    <div class="cards">
        <div class="card">1</div>
        <div class="card">2</div>
        <div class="card">3</div>
        <div class="card">4</div>
        <div class="card">5</div>
    </div>
</div>

CSS

.container {
    width:300px;
    height: 100px;
    border: 2px solid black;
    overflow: hidden;
}
.card {
    float:left;
    height: 100px;
    width: 100px;
    background-color:blue;
    box-sizing: border-box;
    border: 2px solid red;
    color: white;
    font-size: 23px;
}
.cards:hover .card {
    transform: translateX(-100px);
    transition-duration: 1.5s;
    /*   animation-duration: 1.5s;
    animation-fill-mode: forwards;*/
}

JavaScript

$(function () {

    var $container = $('.container');

    $container.on('mouseenter', function (e) {
        e.preventDefault();
        var $card0Clone = $('.card').eq(0).clone();
        $('.cards').append($card0Clone);
        updateWidth();
    });
    $container.on('mouseleave', function (e) {
        e.preventDefault();
        var $cards = $('.card');
        $cards.eq(0).remove();
    });

    function updateWidth() {
        $('.cards').width(($('.card').length) * 100);
    }
});