JSFiddle - React, Tailwind, and code Playground
by edgren
HTML
<div class="image-photo-previous"></div>
CSS
.image-photo-previous {
background-color: #222222;
height: 100px;
width: 200px;
}
JavaScript
$(document).ready(function() {
$('body').on('mouseenter', '.image-photo-previous', function() {
$(this).animate({marginLeft: '-=50px'}, 300, 'swing');
});
$('body').on('mouseleave', '.image-photo-previous', function() {
$(this).animate({marginLeft: '+=50px'}, {queue: false}, 300, 'swing');
});
});