JSFiddle - React, Tailwind, and code Playground
by rich_harris
HTML
<script src="http://www.rich-harris.co.uk/ramjet/ramjet.js"></script>
<button id='go'>go</button>
<div class='a'>a</div>
<div class='b'>b</div>
CSS
body {
font-family: 'Helvetica Neue', arial;
}
.a, .b {
width: 100px;
height: 100px;
line-height: 100px;
color: white;
text-align: center;
font-size: 2em;
}
.a {
background-color: #0074D9;
float: left;
border-radius: 40px;
}
.b {
background-color: #2ECC40;
float: right;
}
button {
display: block;
padding: 1em 2em;
background-color: #eee;
border: none;
font-family: inherit;
font-size: inherit;
margin: 0 0 1em 0;
cursor: pointer;
color: #666;
outline: none;
}
button:hover {
background-color: #ddd;
color: #333;
}
button:disabled {
background-color: #eee;
color: #666;
opacity: 0.2;
cursor: default;
}
JavaScript
a = document.querySelector( '.a' );
b = document.querySelector( '.b' );
go.addEventListener( 'click', function () {
go.disabled = true;
ramjet.transform( a, b, {
done: function () {
go.disabled = false;
},
duration: 2000,
easing: ramjet.easeOut
});
});