views:

44

answers:

2

I would like to enhance a depth effect by hiding the mouse cursor as it passes over a div, is there a method that will work across all browsers?

A: 

You can change the type of cursor you use (pointer, help, crosshair,...) but to hide it... Even if this would be possible in modern browers, older browsers won't support this. Also I can't imagine why you would hide the cursor.

EDIT: in firefox when adding cursor:none; to the body element it hides the cursor untill I go over a link, it's maybe a start.

krike
mmm yeah I know of changing it to the different set states, but ideally i need nothing! Im working on a canvas mega graphic demo, and ideally need the mouse to disappear so I can the simulate it say passing underneath glass
davivid
so actually it wouldn't need to be supported on older browsers thinking about it
davivid
+2  A: 

read: w3cschools

Looks like:

/* css */
div {
    cursor: url(url/to/transparent.gif), auto;
}

should do the trick or:

divEl.style.cursor = 'url(path/to/transparent.gif), auto'; // javascript

But hiding the cursor can annoy visitors immensly.

Addendum: In the examples I wrote .gif files, but you might actually need to convert to .cur or .ani files for better browser support.

BGerrissen
Does this work in Opera? (Don't have it handy, or I'd try it myself.)
Larsenal
dont have opera handy either, works in FF, but not in chrome it seems. Yes it would be very annoying to hide it - I'm planning on redrawing it on a canvas but simulate it underneath things
davivid
see w3cschools link provided in awnser: Note: Opera 9.3 and Safari 3 do not support URL values.
BGerrissen