JSFiddle - React, Tailwind, and code Playground

by FrelCee

HTML

<div id = 'container' >
    <div id = 'first'> First </div>
    <div id = 'second'> Second </div>
    <div id = 'third'> Third </div>
</div>

CSS

#first {
    width: 70px; 
    height: 20px;
    background: #ff0;
    }

    #second{
    width: 70px; 
    height: 20px;
    background: #0f0;
    }

    #third{
    width: 70px; 
    height: 20px;
    background: #f00;
    }

#container{
    width:110px;
    height:auto;
    background:#999;
    overflow:hidden;
}
div {
    margin-top:10px;
    margin-bottom:10px; 
    padding: 10px;
    position:relative;
}

JavaScript

// Hide #first, #second, #third on document ready
$(document).ready(function(){
    $('#first,#second,#third').css("left", "-100px");
});


// On hover function
var hover = $('#container');
$(hover).hover(function(){
    
    $(this).find('#first').animate({left:10}, 600);
    $(this).find('#second').delay(100).animate({left:10}, 600);
     $(this).find('#third').delay(200).animate({left:10}, 600);
    
}, function() {

    $(this).find('#first').animate({left:-100}, 600);
    $(this).find('#second').delay(100).animate({left:-100}, 600);
    $(this).find('#third').delay(200).animate({left:-100}, 600);
    
}); // on mouse out hide divs