拖动鼠标时在HTML5画布上更改光标 [英] Change cursor over HTML5 Canvas when dragging the mouse

查看:542
本文介绍了拖动鼠标时在HTML5画布上更改光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Canvas标签制作了一个油漆刷类型的应用程序。我想当鼠标在画布上的光标更改时,

I have made a paint brush type of application using the Canvas Tag . I wanted that when the mouse is on the canvas the Cursor Changes ,

<canvas id="draw" style="cursor: url(image/pencil.cur)">

我已经完成了这个,但我不能弄清楚如何我改变光标,绘制图像

I have accomplished this but i cant figure out how shall i change the cursor while I Drag the mouse for drawing the image

推荐答案

使用:active CSS伪类当鼠标按钮在元素下方时更改光标:

Use the :active CSS pseudo-class to change the cursor when the mouse button is down over the element:

#draw:active { 
    cursor: url(image/pencil.cur);
}

工作范例: http://jsfiddle.net/nXv63/

这篇关于拖动鼠标时在HTML5画布上更改光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆