Change cursor over HTML5 Canvas when dragging in Chrome

两盒软妹~` 提交于 2019-12-07 18:54:50

问题


I was looking at how to change the cursor over an HTML5 canvas when dragging the mouse... Came across this: Change cursor over HTML5 Canvas when dragging the mouse

seemed logical that an :active pseudo-selector would do the trick...

When I used it on my page, however, the cursor set by the rule in the :active pseudo-selector was ignored, instead showing the text selection cursor.

In firefox, this behavior is not present - it obeys the cursor property I set.

Here's an example to demonstrate the behavior.

Any idea how to fix this in chrome?


回答1:


Working Fiddle

Add the following for Chrome to turn off text selection while dragging and dropping.

document.onselectstart = function(){ return false; }​

This has been answered a few times,

chrome sets cursor to text while dragging, why?

Click and Drag Cursor in Chrome



来源:https://stackoverflow.com/questions/11106955/change-cursor-over-html5-canvas-when-dragging-in-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!