【发布时间】:2015-09-21 08:17:03
【问题描述】:
我正在尝试自定义光标的行为。现在它以另一种方式工作:在 mousemove 上我使用:
scheme.setAttribute("cursor", "move");
鼠标上移:
scheme.setAttribute("cursor", "auto");
在这种情况下:
scheme.setAttribute("cursor", "-moz-grab");
scheme.setAttribute("cursor", "-webkit-grab");
光标仅适用于 -webkit(Chrome)。
在这种情况下
scheme.setAttribute("cursor", "-webkit-grab");
scheme.setAttribute("cursor", "-moz-grab");
光标仅适用于-moz(FF)。
以下结构没有按我的预期工作:
scheme.setAttribute("cursor", "-moz-grab, -webkit-grab");
这行得通:
scheme.setAttribute("style", "cursor:-moz-grab; cursor:-webkit-grab;");
在这两种浏览器中,但我 read here 认为这是不好的做法。
代码here 有效,但我需要使用this 和that 之类的结构。
this 之类的东西(该结构现在不起作用)。
编辑 1
解决方案:
scheme.setAttribute("cursor", "url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur) 4 4, move");
适用于两种浏览器,但仍需要使用 -moz-grab 和 -webkit-grab 值的解决方案。
而且它似乎在 IE 中不起作用(我希望看到第二个,保留移动图标)
编辑 2
更清晰的 mousedown/mouseup 示例:
Case 1:(仅适用于 Chrome)
Case 2:(这里mousedown没有变化)
【问题讨论】:
标签: javascript html css dom mouse-cursor