JSFiddle - React, Tailwind, and code Playground

by Joe Saad

HTML

<div class="parent">
    <div class="child"></div>
</div>

CSS

.parent {
    width: 100px;
    height: 20px;
    border: 2px solid blue;
}
.child {
    width: 50px;
    height: 20px;
    background: red;
    box-shadow: 1px 1px 1px 1px;
    float: left;
}

JavaScript

$('.parent').click(function (event) {
        var target = $(event.target);
        
        if (!(target.is(".child"))) {
            $('.child').animate({"float": "right"}, 5000);
        }
    });