在Chrome中拖动时,将光标置于HTML5画布上 [英] Change cursor over HTML5 Canvas when dragging in Chrome

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

问题描述

我在看着如何在拖动鼠标时在HTML5画布上改变光标...
遇到这个问题:

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...

但是,当我在我的页面上使用它时,通过:active伪选择器中的规则设置的游标是

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.

在Firefox中,此行为不存在 - 它遵守我设置的游标属性。

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

这里是一个示例来演示此行为。

Here's an example to demonstrate the behavior.

有什么想法如何在chrome中解决这个问题?

Any idea how to fix this in chrome?

推荐答案

工作小提琴

Working Fiddle

为Chrome添加以下内容关闭文本选择。

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

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

这已经回答了几次,

Chrome会在拖动时将光标设置为文本,为什么?

点击并拖动Cursor in Chrome

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

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