JSFiddle - React, Tailwind, and code Playground

by chiragvidani

HTML

<img src="https://softwebsolutions.basecamphq.com/companies/353865/logo.gif" border="1" class="original">
<img src="https://softwebsolutions.basecamphq.com/companies/837835/logo.gif" border="1" class="rollover" />

CSS

.rollover {
    position: absolute !important;
}

JavaScript

var l = $('.rollover').offset().left;
$('.original').click(function () {
    //$(this).next().animate('slow');    
    if (l == 50) l = 0
    else l = 50;
    $(this).next().animate({
        'left': l + 'px'
    }, 'slow');

});