SO - 26033970

by Arun P Johny

HTML

<div class="text-bg">
    <div class="text-top-left">text-top-left</div>
</div>

CSS

.text-bg {
    position:relative;
}
.text-top-left {
    position:absolute;
    width: 150px;
    background-color: lightgrey;
}

JavaScript

var $texte = $('.text-bg');

$texte.children('.text-top-left').click(function () {
    var $this = $(this),
        flag = $this.data('animToggle');
    $this.data('animToggle', !flag);
    $this.animate({
        'left': flag ? '0' : '-100px'
    })
})