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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:33:00+00:00 2026-06-09T01:33:00+00:00

I am working on a little HTML/JavaScript/CSS3 project for fun. I’m basically trying to

  • 0

I am working on a little HTML/JavaScript/CSS3 project for fun. I’m basically trying to make a wheel that rolls around in the browser window. To control the wheel I’m using keyup and keydown events for the cursor keys (left and right turn the wheel and up and down roll it forward or backward).

I’ve got it working pretty well so far, but there are two major glitches. Say I want to roll the wheel forward and without stopping I want to turn it a little to the right, then I would keep the up key pressed and press the right cursor key. When I do this there’s a pause in the movement before it registers both events and keeps rolling.

That’s one of the problems, the main problem is that, once I’ve performed the previous action and then wheel is at a desirable angle, if I let go of the right cursor key the browser registers both keys as released and the wheel comes to a stand still. Here is a jsFiddle of what it looks like: http://jsfiddle.net/UKqwu/1/. I know the code is a mess but it’s a work in progress/learning experience and I’ve only been programming for a month or so.

Anyways thanks for any help. It only works in Chrome at the moment as far is I know. Haven’t really been bothered fixing compatibility issues at this stage.

  • 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-09T01:33:02+00:00Added an answer on June 9, 2026 at 1:33 am

    So, what is happening is essentially a limitation built in by your operating system, but there is a simple work-around. First I’ll explain the limitation, and then the work-around.

    If you were to (in a text box) hold down the “j” button, first one “j” would appear, and then after a short delay many “j”s would appear “jjjjjjjjjjjjjjjjjjjj”

    This is the same problem your experiencing. The event fires once, waits for a moment, and then fires many more times.

    The solution, however is simple. Instead of having your wheel move when the events are fired… have it update constantly, and separately keep track of what keys are up or down.

    The Key Handler would look something like this…

    function KeyHandler() {
      this.left = false;
      this.right= false;
      ...
      function onKeyDown(e) {
        if (e.keyCode == 37) {
          this.left = true;
        }
        ...
      }
      function onKeyUp(e) {
        if (e.keyCode == 37) {
          this.left = false;
        }
        ...
      }
    }
    

    (you’d attach the key handler to the body or whatever element you wish)

    Your wheel would have an update function that looked like…

    wheel.update = function() {
      // the wheel is turning left
      if (wheel.keyhandler.left) {
        // make the appropriate adjustments
      }
    }
    

    and then the game would have something like this…

    wheel = new Wheel;
    setInterval(function() {
      wheel.update();
    },100);
    

    That way your wheel will always be updating based on the current state of the keys, and you wont have to rely on the limitations of events that are firing. 🙂

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

Sidebar

Related Questions

I'm working on a program that uses HTML/CSS/Javascript/JQuery for its user interface. One of
I'm trying to use javascript as little as possible on this project. I would
I'm trying to build a little calendar in JavaScript. I have my dates working
I've been working on a fun little side project to customize the dale harvey's
I'm currently working on a little html/js site and my current goal is to
I'm working on a little program to make my life easier when using Microsoft
I'm working on a little project right now in ActionScript 3. The project is
I'm working on a little something and I am trying to figure out whether
I am working on a little WinForm app and have been trying to find
I'm working on a little WPF app that will run fullscreen and I'd like

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.