REVISED: Are there any jQuery plugins that can revolve one element around another?
EDIT: By "orbiting", I mean rotating on the same z-index around another element.
THIS ANSWER SUPERCEDED BY MY OTHER RESPONSE TO THIS QUESTION.
You could use the ".animate()" method to modify the "top" and "left" properties of the element. Here is an example fiddle.
HTML:
<div id='moon' > moon </div> <div id='earth'> earth </div>
CSS:
#moon {position: absolute;
top: 0px;
left: 0px;
width: 50px;
height: 50px;
background-color: #aaaaff;}
#earth {position: absolute;
top: 50px;
left: 50px;
width: 50px;
height: 50px;
background-color: #ffaaaa;}
Javascript:
$('#moon').animate({left: 100}, 2000)
.animate({top: 100}, 2000)
.animate({left: 0}, 2000)
.animate({top: 0}, 2000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With