Reputation: 313
I have an HTML chessboard with chess pieces, and everything works. In order to avoid the drag & drop tediousness, I made the chess pieces background-images. On mousedown
, I remove the piece at the position, and on mouseup
I place it back. The only thing that is missing from the aesthetic is the image of the piece to be displayed under the cursor in-between.
I tried this:
cursor:url('http://upload.wikimedia.org/wikipedia/commons/c/c7/Chess_pdt45.svg'), auto;
But there are several setbacks with this method.
The image cursor needs to be at most 32x32 pixels in order to guaranty compatibility
It's unclear whether the format I want will be supported at all.
I don't know if the cursor image has width
and height
properties, meaning I cannot resize the image so that it looks exactly like what's on the board.
The cursor position is top-right, whereas it should be centered-centered, since chess pieces are... well, held from their center.
The big question is whether there's a workaround to all of that. Is it, for instance, possible to make a canvas that appears under the mouse?
Upvotes: 0
Views: 1036
Reputation: 13103
Unfortunately, you cannot modify cursor properties, like width/height
or position
...
But, I have found interesting article how to imitate cursor with div element. http://www.ajaxblender.com/howto-create-custom-image-cursors.html
Hope this helps you!
Upvotes: 1