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 9038857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:35:27+00:00 2026-06-16T09:35:27+00:00

I have a small working piece. HTML: <div id=it>X</div> CSS: #it { background: blue;

  • 0

I have a small working piece.

HTML:

<div id="it">X</div>

CSS:

#it {
    background: blue;
    width: 40px;
    text-align: center;
    color: white;
    padding: 10px 0;
    border: solid 1px black;
    border-radius: 25px;
    position: absolute;
    left: 100px;
    top: 100px;
}

JS:

$('#it').animate({
    left: '+=100',
    top: '+=100'
}, 400, function() {
        $(this).animate({
        top: '-=100'
    }, 400, function() {
        $(this).animate({
            left: '-=100',
            top: '+=100'
        }, 400, function() {
            $(this).animate({
                top: '-=100'
            }, 400);
        });
    });
});

Everything aforementioned put together in this jsfiddle

What I need help with:

  1. Loop the JS. Besides, I’m almost sure that something can be done to simplify that repeated nested code.
  2. Make the movement smooth. I.e., make the object fly in a single curved line tracing a “tilted 8” shape, rather than in 4 strait lines.
  3. If possible, get rid of JS and replace it with CSS3.

Also not necessarily required for my project, but would be amazing if there was a way to rotate the object along the way so it always faces the direction it is heading. Like as if you were watching a race car from above.

  • 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-06-16T09:35:28+00:00Added an answer on June 16, 2026 at 9:35 am

    I have already converted your JavaScript to CSS3: here it is for you.

    It is looped and uses CSS3, and works in IE 10, chrome, firefox, and safari. I don’t have opera so I cannot test and IE 9 and down will need to use a CSS3 shiv.

    @-webkit-keyframes move {
    0%   {top:  100px;
          left: 100px;}
    25%  {top:  250px;
          left: 250px;}
    50%  {top:  100px;
          left: 250px;}
    75%  {top:  250px;
          left: 100px;}
    100% {top:  100px;
          left: 100px;}
    }
    

    That code replaces the JavaScript you had; it creates the animation in segments. It is only the webkit part of the animation syntax though, to make sure you cover all of your bases, don’t forget @-moz- and @keyframes for the standard spec animation syntax.

    -webkit-animation:move 5s infinite;
    

    This CSS3 rule tells the parser what element should be using the declared animation.

    Rotating the item can be done using the transform css declaration, which I will work on and update ASAP.​ So far I have gotten transforms to work in every browser. Additionally, I tilted the whole animation at an angle just like you asked so that it will look like an infinity sign. Getting a smooth corner turn is quite difficult right now without complex math or advanced use of transitions and extra animations, I am not quite sure how to do it right. I will see what can be done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small html file working in the frame of a website. It
I have a small project that I will be working on shortly that collects
I have a small problem when im working with a menu and a list
I have a small app I'm working on where I'm trying to use Django's
I have a small self made gallery which im still working on it: http://springbreak.enteratenorte.com
i have developed a small application and was working fine on developing machine but
Iam working on small booking room system. In my solution I have a Reservation
I have been working on a small php app (400K total). But in the
I'm working on a small uni project where I have a program for a
I have a set of small images which is working fine in Firefox but

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.