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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:24:35+00:00 2026-06-05T15:24:35+00:00

Go Here Use UP and DOWN keys When I press a key, the red

  • 0

Go Here

Use UP and DOWN keys

When I press a key, the red box moves down, pauses, then moves the rest.

How do I remove the pause?

  • 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-05T15:24:36+00:00Added an answer on June 5, 2026 at 3:24 pm

    You should follow keydown as well as keyup and use an interval to move the paddle more smoothly.

    Demo: http://jsfiddle.net/M7TKc/16/

    var paddle = $("#paddle");
    paddle.css({backgroundColor: "red", height:"100px", width:"25px", position: "absolute"});
    
    var paddle_y = 0,
        moving = 0;  /* added */
    
    draw_paddle();
    
    window.setInterval(function () {  /* added */
        if (moving != 0) {
            paddle_y += moving;
            draw_paddle();
        }}, 100);
    
    function move_down(){
        moving = -10;
    }
    function move_up(){
        moving = 10;
    }
    
    function draw_paddle(){
        paddle.css({top: paddle_y+"px"});
    }
    
    $(document).keypress(function(e) {
        if(e.which == 13) {
            // stop on "ENTER"
            moving = 0;
        }
    });
    $(document).keydown(function(e){  /* changed */
        if (e.keyCode == 38)
            move_down();
        else if (e.keyCode == 40)
            move_up();
    
    });
    
    $(document).keyup(function(e){  /* added */
        if (e.keyCode == 38 || e.keyCode == 40)
            moving = 0;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here I use two images. when i click once on the Sort_down.png image then
Does anyone here use phpmailer? I downloaded the files for phpmailer 5.2.1 (the newest
I don't understand what happens here : use PAR { file => 'foo.par', fallback
I'm trying to create a web application project template for everyone to use here
hy, i need a little help here: i use SWFupload to upload images! in
Here's the use case: A user clicks on a link that opens a window
If I use a here document in a shell script that contains multiple backslashes
Has anyone here tried to use a custom animation with MBProgressHUD. There is a
Tried following the instructions here: How to use Google app engine with my own
I've set up my jqGrid to use cell editing, and I've bound some keys

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.