Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by hallsofvallhalla

Whats the best method to change the mouse cursor? I can't seem to get anything to work. Like change the arrow to a target when over the canvas.

1 decade ago by dominic

You can specify an image file to be used as the cursor via CSS - i.e. in your index.html file:

#canvas {
	...
	cursor: url(cursor-image.png), auto;
}

For a completely invisible cursor, you can use this shorthand:
#canvas {
	...
	cursor: url('data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto;
}

1 decade ago by hallsofvallhalla

thanks! works perfect

1 decade ago by pattentrick

I know that this is a very old thread, but the code above does not work on all browsers, or has some disadvantages (e.g 1px X 1px dot in chrome).

I finished my small point and click adventure yesterday and spend almost the whole day, figuring out how to do this. This one will work in FF, IE, Chrome and Safari:

            cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjbQg61aAAAADUlEQVQYV2P4//8/IwAI/QL/+TZZdwAAAABJRU5ErkJggg=='),
            url(media/blank.cur),
            none !important;

The .cur file is for IE, and needs be a blank and transparent image. But as far as i know, there is no way you can hide the cursor in Opera. I literally tried everything to get it to work in Opera without any success.
Page 1 of 1
« first « previous next › last »