<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<body>
<div class="container-fluid text-center">
<div class="row">
</div>
<div class="row">
<img class="responsive-img" id="sun" src="http://orig02.deviantart.net/5786/f/2013/025/7/1/free_sun_stock_image_by_lyra_elante-d5spggh.png" alt="this is a sun">
<div id='earth-orbit'>
<img id="earth" src="http://img11.deviantart.net/8762/i/2014/247/3/2/earth___europe_by_mystica_264-d7xwrs5.png" alt="this is the earth">
</div>
<div id='jupiter-orbit'>
<img id="jupiter"
src="https://2.bp.blogspot.com/-grGCMQsVb5U/UJurAJLCJhI/AAAAAAAAABc/iXmLFh-PVdw/s1600/planet-jupiter-large.gif" alt="this is the jupiter planet">
</div>
<div id='mars-orbit'>
<img id="mars" src="http://img3.wikia.nocookie.net/__cb20130916161813/factfinder/images/c/c5/Mars-1-.png">
</div>
<div id=''>
<img id="spacecraft" src="https://upload.wikimedia.org/wikipedia/commons/9/94/Rosetta_spacecraft_(transparent_bg).png" alt="this is α spacecraft">
</div>
<div id="container">
<div class='a'><img class="random-astro"
src="http://www.immediateentourage.com/ie/wp-content/uploads/2011/10/Astronaut+by+NASA+cropped+by+Immediate+Entourage2.png" alt="this is an astronaut-1"></div>
<div class='b'><img class="random-astro"
src="http://www.clipartqueen.com/image-files/astronaut.png" alt="this is an astronaut-2"></div>
<div class='c'><img class="random-astro"
src="http://www.clipartqueen.com/image-files/astronaut.png" alt="this is an astronaut-3"></div>
</div>
</div>
<div class="row text-center">
<h5><a href="http://www.eleftheriabatsou.com" target="_blank">Eleftheria </a> | <a href="https://codepen.io/EleftheriaBatsou" target="_blank">Projects</a> | <a href="https://www.youtube.com/channel/UCC-WwYv3DEW7Nkm_IP6VeQQ" target="_blank"> Coding videos </a></h5>
</div>
</div>
</body>
a:link {color:#B24900; text-decoration:none}
a:visited {color:#B24900; text-decoration:none}
a:hover {color:#FF8633; text-decoration:underline}
html, body {
width: 100%;
height: 100%;
background-image: url("https://static.pexels.com/photos/110854/pexels-photo-110854-medium.jpeg");
background-size: contain;
background-attachment: fixed;
background-color: black;
}
#sun {
position: absolute;
top: 50%;
left: 50%;
height: 400px;
width: 400px;
margin-top: -230px;
margin-left: -200px;
}
#earth {
position: absolute;
top: 0;
left: 50%;
height: 40px;
width: 40px;
margin-left: -25px;
margin-top: -25px;
}
#earth-orbit {
position: absolute;
top: 50%;
left: 50%;
width: 320px;
height: 320px;
margin-top: -180px;
margin-left: -160px;
-webkit-animation: spin-right 10s linear infinite;
-moz-animation: spin-right 10s linear infinite;
-ms-animation: spin-right 10s linear infinite;
-o-animation: spin-right 10s linear infinite;
animation: spin-right 10s linear infinite;
}
#jupiter{
width: 70px;
height: 70px;
}
#jupiter-orbit{
position: absolute;
top: 50%;
left: 50%;
width: 600px;
height: 600px;
margin-top: -300px;
margin-left: -290px;
-webkit-animation: spin-right 12s linear infinite;
-moz-animation: spin-right 12s linear infinite;
-ms-animation: spin-right 12s linear infinite;
-o-animation: spin-right 12s linear infinite;
animation: spin-right 12s linear infinite;
}
#mars{
width: 25px;
height: 25px;
}
#mars-orbit{
position: absolute;
top: 50%;
left: 50%;
width: 450px;
height: 450px;
margin-top: -230px;
margin-left: -230px;
-webkit-animation: spin-right 8s linear infinite;
-moz-animation: spin-right 8s linear infinite;
-ms-animation: spin-right 8s linear infinite;
-o-animation: spin-right 8s linear infinite;
animation: spin-right 8s linear infinite;
}
@-webkit-keyframes spin-right {
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes spin-right {
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#spacecraft{
width: 420px;
height: 200px;
margin-top: -60px;
margin-left: 40%;
-webkit-animation: bounce 2s infinite ease-in-out;
}
@-webkit-keyframes bounce {
0%, 20%, 60%, 100% { -webkit-transform: translateY(0); }
40% { -webkit-transform: translateY(-20px); }
80% { -webkit-transform: translateY(-10px); }
}
.random-astro{
width: 30px;
height: 50px;
}
div#container {height:500px;width:100%;}
div.a , .b, .c{
position:fixed;
}
$(document).ready(function() {
animateDiv($('.a'));
animateDiv($('.b'));
animateDiv($('.c'));
});
function makeNewPosition($container) {
var h = $container.height() - 20;
var w = $container.width() - 20;
var nh = Math.floor(Math.random() * h);
var nw = Math.floor(Math.random() * w);
return [nh, nw];
}
function animateDiv($target) {
var newq = makeNewPosition($target.parent());
var oldq = $target.offset();
var speed = calcSpeed([oldq.top, oldq.left], newq);
$target.animate({
top: newq[0],
left: newq[1]
}, speed, function() {
animateDiv($target);
});
};
function calcSpeed(prev, next) {
var x = Math.abs(prev[1] - next[1]);
var y = Math.abs(prev[0] - next[0]);
var greatest = x > y ? x : y;
var speedModifier = 0.1;
var speed = Math.ceil(greatest / speedModifier);
return speed;
}