JSFiddle - React, Tailwind, and code Playground
by kmburke84
HTML
<section id="container">
<div class="click">
<div class="box">
</div>
</div>
</section>
<script src="IA05.js"></script>
CSS
@charset "UTF-8";
#container {
width:100%;
height:100%;
}
.box {
width:200px;
height:200px;
background-color:#0000FF;
border-radius: 50%;
position:relative;
}
JavaScript
$(document).ready(function(){
var height = $(window).height();
var width = $(window).width();
//var timeoutID = window.setTimeout(function(infinite),500)
$('.click').click(function(){
function infinite(){
$('.box')
.animate({left:width},1500)
.animate({top:height},1500)
.animate({left:'0%'},1500)
.animate({top:'0px'},1500,infinite)
}
infinite();
});
});