Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6593995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:45:15+00:00 2026-05-25T17:45:15+00:00

REVISED: Are there any jQuery plugins that can revolve one element around another? EDIT:

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:45:16+00:00Added an answer on May 25, 2026 at 5:45 pm

    Below is is simple jQuery plugin that I’ve developed to provide the “orbiting” functionality you asked for. See this fiddle for an example of how to use it.

        ( function ( $ ) {
            jQuery.fn.orbit = function(s, options){
                var settings = {
                                orbits:    1     // Number of times to go round the orbit e.g. 0.5 = half an orbit
                               ,period:    3000  // Number of milliseconds to complete one orbit.
                               ,maxfps:    25    // Maximum number of frames per second. Too small gives "flicker", too large uses lots of CPU power
                               ,clockwise: true  // Direction of rotation.
                };
                $.extend(settings, options);  // Merge the supplied options with the default settings.
    
                return(this.each(function(){
                    var p        = $(this);
    
    /* First obtain the respective positions */
    
                    var p_top    = p.css('top' ),
                        p_left   = p.css('left'),
                        s_top    = s.css('top' ),
                        s_left   = s.css('left');
    
    /* Then get the positions of the centres of the objects */
    
                    var p_x      = parseInt(p_top ) + p.height()/2,
                        p_y      = parseInt(p_left) + p.width ()/2,
                        s_x      = parseInt(s_top ) + s.height()/2,
                        s_y      = parseInt(s_left) + s.width ()/2;
    
    /* Find the Adjacent and Opposite sides of the right-angled triangle */
                    var a        = s_x - p_x,
                        o        = s_y - p_y;
    
    /* Calculate the hypotenuse (radius) and the angle separating the objects */
    
                    var r        = Math.sqrt(a*a + o*o);
                    var theta    = Math.acos(a / r);
    
    /* Calculate the number of iterations to call setTimeout(), the delay and the "delta" angle to add/subtract */
    
                    var niters   = Math.ceil(Math.min(4 * r, settings.period, 0.001 * settings.period * settings.maxfps));
                    var delta    = 2*Math.PI / niters;
                    var delay    = settings.period  / niters;
                    if (! settings.clockwise) {delta = -delta;}
                    niters      *= settings.orbits;
    
    /* create the "timeout_loop function to do the work */
    
                    var timeout_loop = function(s, r, theta, delta, iter, niters, delay, settings){
                        setTimeout(function(){
    
    /* Calculate the new position for the orbiting element */
    
                            var w = theta + iter * delta;
                            var a = r * Math.cos(w);
                            var o = r * Math.sin(w);
                            var x = parseInt(s.css('left')) + (s.height()/2) - a;
                            var y = parseInt(s.css('top' )) + (s.width ()/2) - o;
    
    /* Set the CSS properties "top" and "left" to move the object to its new position */
    
                            p.css({top:  (y - p.height()/2),
                                   left: (x - p.width ()/2)});
    
    /* Call the timeout_loop function if we have not yet done all the iterations */
    
                            if (iter < (niters - 1))  timeout_loop(s, r, theta, delta, iter+1, niters, delay, settings);
                        }, delay);
                    };
    
    /* Call the timeout_loop function */
    
                    timeout_loop(s, r, theta, delta, 0, niters, delay, settings);
                }));
            }
        }) (jQuery);
    
        $('#mercury').orbit($('#sun'  ), {orbits:  8, period:  2000});
        $('#venus'  ).orbit($('#sun'  ), {orbits:  4, period:  4000});
        $('#earth'  ).orbit($('#sun'  ), {orbits:  2, period:  8000}).css({backgroundColor: '#ccffcc'});
        $('#moon'   ).orbit($('#earth'), {orbits: 32, period:   500, maxfps: 20, clockwise: false});       
        $('#mars'   ).orbit($('#sun'  ), {orbits:  1, period: 16000});
    

    The HTML for this example is:

    <h1> The inner planets of the Solar System</h1>
    <div id='solar_system'>
        <div id='sun'    >SUN</div>
        <div id='mercury'>m</div>
        <div id='venus'  >v</div>
        <div id='earth'  >e</div>
        <div id='moon'   >m</div>
        <div id='mars'   >m</div>
    </div>
    

    The CSS for this example is:

    #solar_system {position: relative; width: 1600px; height: 1600px; background-color: #222222}
    #sun          {position: absolute; width:  80px; height:  80px;
                   top: 380px; left: 580px; background-color: #ffff00;
                   -moz-border-radius: 40px; border-radius: 40px;
                   text-align: center; line-height: 80px;
    }
    #mercury      {position: absolute; width:  18px; height:  18px;
                   top: 335px; left: 535px; background-color: #ffaaaa;
                   -moz-border-radius:  9px; border-radius:  9px;
                   text-align: center; line-height: 18px;
    }
    #venus        {position: absolute; width:  36px; height:  36px;
                   top: 300px; left: 500px; background-color: #aaaaff;
                   -moz-border-radius: 18px; border-radius: 18px;
                   text-align: center; line-height: 30px;
    }
    #earth        {position: absolute; width:  30px; height:  30px;
                   top: 200px; left: 400px; background-color: #ffaaaa;
                   -moz-border-radius: 15px; border-radius: 15px;
                   text-align: center; line-height: 30px;
    }
    #moon         {position: absolute; width:  12px; height:  12px;
                   top: 150px; left: 350px; background-color: #cccccc;
                   -moz-border-radius: 6px; border-radius: 6px;
                   text-align: center; line-height: 12px;
    }
    #mars        {position: absolute; width:  24px; height:  24px;
                   top: 100px; left: 200px; background-color: #ffaaaa;
                   -moz-border-radius: 12px; border-radius: 12px;
                   text-align: center; line-height: 24px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

there is my situation. I have same activities which goes one by another, no
Revised Code jQuery(function($) { $(#filter).keyup(function () { var filter = $(this).val(), count = 0;
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
I am revamping a website that now uses jQuery. The process is more than
I was wondering if there is a python cognate to PHP's crypt() function that
EDIT: To answer some questions, this is the revised and still not working code
I'm working on an ASP.NET project that replaces many existing paper forms. One of
See Edit below initial question for a revised version of the original problem Using
REVISED QUESTION I have revised the original question (as seen below) so that I
REVISED QUESTION : We have tracked this down to a custom add to cart

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.