JSFiddle - React, Tailwind, and code Playground

by Emre Erkan

HTML

<div class="container">
 CONTAINER ONE
</div>

<div class="container">
 CONTAINER TWO
</div>

CSS

.container {
    text-align:center;
    float:left;
    width:200px;
    height:20px;
    background:#F90;
    margin: 20px;
}

JavaScript

$(document).ready(function()
{
    var over = function(){
        $(this).stop().animate({'padding-bottom':'10px'},{queue:false,duration:160});
    };
    var out = function() {
        $(this).stop().animate({'padding-bottom':'0px'},{queue:false,duration:160});
    };
    //the default hover-event
    $('.container').hover(over, out);



    $('.container').click(function(e) {
        e.preventDefault();

        // enables the mouseleave for all other `.container`s again.
        // also bring the old clicked element into unhovered position again
        $('.container').bind('mouseleave', out).not(this).each(out);

        // supress the mouseleave for the clicked element
        $(this).unbind('mouseleave');
    })
});