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

  • Home
  • SEARCH
  • 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 6089753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:08:08+00:00 2026-05-23T12:08:08+00:00

On my site there are two bags with div ids cloud and cloud2, and

  • 0

On my site there are two bags with div ids “cloud” and “cloud2”, and they are inside a div “sky”

The JQuery script below is supposed to move the bags/clouds to the right, but I can`t get it to work.

Can you please tell me what I`m doing wrong?

I`m a bit of a newbie, so please keep that in mind when answering. Thanks for your help

<script>
    var cloudMoved = false;
    var cloud2Moved = false;

    $(init);

    function init()
    {
        cloudMove();
        cloud2Move();
        }

    function cloudMove()
    {
        if (!cloudMoved)
        {
            $("#cloud")
                .css("left", $("#cloud").offset().left)
        }

        $("#cloud")
            .animate(
                {
                    left: $("#sky").width()
                },
                cloudMoved ? 180000 : 150000,
                "linear",
                function()
                {
                    $(this)
                        .css("left", -parseInt($(this).css("width")))
                    cloudMoved = true;
                    cloudMove();
                }
            )
    }

    function cloud2Move()
    {
        if (!cloud2Moved)
        {
            $("#cloud2")
                .css("left", $("#cloud2").offset().left)
        }
        $("#cloud2")
            .animate(
                {
                    left: $("#sky").width()
                },
                cloud2Moved ? 120000 : 60000,
                "linear",
                function()
                {
                    $(this)
                        .css("left", -parseInt($(this).css("width")))
                    cloud2Moved = true;
                    cloud2Move();
                }
            )
    }



    </script>

CSS

.custom #sky
{
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 131px;
    overflow: hidden;
}  


.custom #cloud
{
    position: absolute;
    left: 5%;
    top: 15px;
    z-index: 2;
    width: 120px;
    height: 91px;
        background-repeat: no-repeat;
}

.custom #cloud2
{
    position: absolute;
    left: 25%;
        z-index: 3;
        top: 65px;
    width: 101px;
    height: 66px;
        background-repeat: no-repeat;
}
  • 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-23T12:08:09+00:00Added an answer on May 23, 2026 at 12:08 pm

    I believe if you add semicolons to a few of your statements, the code should work.

    <script type="text/javascript">
        var cloudMoved = false;
        var cloud2Moved = false;
    
        function init() {
            cloudMove();
            cloud2Move();
        }
    
        function cloudMove() {
            if (!cloudMoved) {
                $("#cloud").css("left", $("#cloud").offset().left);
            }
            $("#cloud").animate({left: $("#sky").width()},
                    cloudMoved ? 180000 : 150000,
                    "linear",
                    function() {
                        $(this).css("left", -parseInt($(this).css("width")));
                        cloudMoved = true;
                        cloudMove();
                    });
        }
    
        function cloud2Move()
        {
            if (!cloud2Moved) {
                $("#cloud2").css("left", $("#cloud2").offset().left);
            }
            $("#cloud2").animate({left: $("#sky").width()},
                    cloud2Moved ? 120000 : 60000,
                    "linear",
                    function() {
                        $(this).css("left", -parseInt($(this).css("width")));
                        cloud2Moved = true;
                        cloud2Move();
                    });
        }
        $(document).ready(function(){
            $(init);
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a duplicate content issue where there's two instances of my site indexed
i have multilingual asp.net site. there is a masterpage and default.aspx. I put two
The code below is resulting in an error on a site in which there
When using .htaccess to redefine the URLs for a site, there are two clear
In the w3school site there are two tutorials: HTML DOM XML DOM I want
On this site there is a picture with two tab-systems. I would like to
i am building a site. There are two choices for me. asp.net mvc 3.0
I'm putting together a fixed, one-page site that deploys an overlay using jQuery. There
There are two websites, more are probably coming. One is a simple PHP site
I am working on a contest site where there are two types of users,

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.