Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mouse cursor change based on event

I have an ajax request that I'm sending. When the request starts, I have

  document.body.style.cursor = "wait";

which immediately changes the appearance of the cursor to a spinning circle.

When the request ends, I have

  document.body.style.cursor = "default";

However, this only returns the cursor to its original state when the user moves the mouse; if the mouse stays still, the cursor won't change. When you set it to "auto" or any other kind, the cursor change will only trigger when it moves.

Any ideas?

like image 636
frenchie Avatar asked Feb 14 '11 00:02

frenchie


People also ask

What is mouse Move event?

The mousemove event occurs whenever the mouse pointer moves within the selected element. The mousemove() method triggers the mousemove event, or attaches a function to run when a mousemove event occurs. Note: Each time a user moves the mouse one pixel, a mousemove event occurs.

How do I change my cursor behavior?

In the Mouse Properties box, click on the Pointers and Pointer Options tab, and adjust the options to change the shape and size of your cursor by changing the “scheme”. In the “Pointer Options” tab, you can change the speed, visibility, and other characteristics of your pointer.

Can you still customize your mouse cursor?

To change how the mouse pointer looks In the search box, type mouse, and then click Mouse. Click the Pointers tab, and then do one of the following: To give all of your pointers a new look, click the Scheme drop-down list, and then click a new mouse pointer scheme.

How do I control mouse cursor?

To turn on Mouse Keys , clicking Control Panel, clicking Ease of Access, and then clicking Ease of Access Center. Click Make the mouse easier to use. Under Control the mouse with the keyboard, select the Turn on Mouse Keys check box.


2 Answers

just scroll window by 0,0.

document.body.style.cursor = "auto";
window.scroll(0, 0);
// tested in IE8 and FF3.6

And when the request ends, you need to set cursor to "auto", not a "default". You can see the difference on any element with text.

like image 132
kirilloid Avatar answered Oct 20 '22 19:10

kirilloid


It's a chrome bug: http://code.google.com/p/chromium/issues/detail?id=26723

like image 33
frenchie Avatar answered Oct 20 '22 18:10

frenchie