JSFiddle - React, Tailwind, and code Playground

by lollero

HTML

<div>DIV</div>

JavaScript

var div = $('div');

div.animate({ marginLeft: 300 }, 6000 );

$(document).on("keypress", function( e ) {

   if ( e.keyCode == 32 ) {

      div.clearQueue();
      div.stop();

   };

});