HTML5画布手游标问题 [英] html5 canvas hand cursor problems

查看:74
本文介绍了HTML5画布手游标问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩HTML5和一些JavaScript来制作一个小画板。每当我在chrome中单击画布时,光标就会变成文本光标。我试图把光标放在CSS中,但这似乎不起作用。这是一件容易的事情,但我会查找并找不到任何地方。 使用禁用文本在画布上进行选择。这就像一个魅力。

  var canvas = document.getElementById('canvas'); 
canvas.onselectstart = function(){return false; } // ie
canvas.onmousedown = function(){return false; } // mozilla

干杯,
克里斯


I'm playing around with html5 and some javascript to make a minor sketchpad. Whenever I click down on the canvas in chrome, the cursor becomes a text cursor. I have tried putting cursor: hand in the css, but that doesn't seem to work. This has got to be an easy thing, but I look it up and can't find it anywhere

解决方案

Use the disable text selection on the canvas. This works like a charm.

var canvas = document.getElementById('canvas');
canvas.onselectstart = function () { return false; } // ie
canvas.onmousedown = function () { return false; } // mozilla

Cheers, Kris

这篇关于HTML5画布手游标问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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