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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:41:39+00:00 2026-05-12T05:41:39+00:00

I have a trivial little game I wrote in javascript that creates a wave

  • 0

I have a trivial little game I wrote in javascript that creates a wave from where you click. I figured out two ways to make the “wave” move across the screen:

  1. by calling jQuery.animate() with increasingly large times. demo
  2. by recursvely calling setTimeout. demo

The problem I have is that I want the behavior of 2 (columns all grow at the same speed with an offset timing) but with the action of 1 (subsequent clicking compounds the “waves” formed).

Right now on the second demo, if you click again before the “wave” is finished, it immediately clears the setTimeouts and starts them all over again. I want to be able to stack them like in the first example.

You can view the source of either of those pages to see the code (methods are getMouseXYUp and getMouseXYDown).

the basic gist of what i am doing in the second demo is found in these two functions:

function getMouseXYUp(e) {
            $("body").die('mousemove');

            h = (document.height - e.pageY + 17);
                left = id-1;
                right = id+1;
            setTimeout("moveleft()", 100);
            setTimeout("moveright()", 100);

            return true
        }

function moveleft(){
        if (left >= 0){
            $("#div"+left).animate({'height': h}, 400);
            left--;
            setTimeout("moveleft()", 50);
        }
    }
  • 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-12T05:41:39+00:00Added an answer on May 12, 2026 at 5:41 am

    The problem is that you’re resetting the variables “left” and “right” as soon as the second mouse click happens. Is this any closer to what you’re looking for?

        function getMouseXYUp(e) {
            $("body").die('mousemove');
    
            var h = (document.height - e.pageY + 17);
            var left = id-1;
            var right = id+1;
            setTimeout(function() { moveleft(left, h); }, 100);
            setTimeout(function() { moveright(right, h); }, 100);
    
            return true;
        }
    
        ...
    
        function moveleft(left, h) {
            if (left >= 0){
                $("#div"+left).animate({'height': h}, 400);
                left--;
                setTimeout(function() { moveleft(left, h); }, 50);
            }
        }
    
        function moveright(right, h) {
            if (right < divs){
                $("#div"+right).animate({'height': h}, 400);
                right++;
                setTimeout(function () { moveright(right, h); }, 50);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a little SilverLight Out-of-Browser app that captures a series of images from
Let's say I have an existing trivial XML file named 'MyData.xml' that contains the
I'm creating a game with points for doing little things, so I have a
I have a little problem that perhaps you can help me with. I try
I have an application that allows administrators to specify valid IP addresses from which
I have some trivial markup that looks like the following: <li class=someclass> <=% t'model.attr'
I have some trivial code that looks like this: SortedDictionary<String, long> d = new
I need a little utility function that generates a checksum from an array of
I have a trivial console application in .NET. It's just a test part of
I’ve only just started using ASP.NET MVC, and I have a somewhat trivial question:

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.