JSFiddle - React, Tailwind, and code Playground

HTML

<div id="ropes"></div>

CSS

#ropes
{
    width: 10px;
    height: 300px;
    background-color: brown;
    position: absolute;
    left: 100px;
}

JavaScript

$(function() {
    var func = function() {
        $("#ropes").animate({
            "left": "10px"
        }, 1000, function() {
            $(this).animate({
                "left": "60px"
            }, 1000)
        })
        setTimeout(func, 2000)
    }
    func()
    
});