1

如何cursor使用 CSS 3 相对于鼠标位置定位元素(例如不适合该属性的复杂光标)?

我知道如何用 JavaScript 做到这一点,但它看起来太不稳定了;当缺乏支持时,我宁愿使用 CSS 并回退到 jQuery。(当我直接使用元素并绕过 jQuery 时的事件,它太慢了。)

如有必要,可以使用 JavaScript 进行准备等。虽然原则上并不可取,但 JavaScript 是可以接受的,只要它不负责每次鼠标移动时更新元素。

我恳请不要用答案来解释为什么不能实现这一点,因为 CSS 正在迅速发展,解决这个问题的未来潜力可能会改变。随意在评论中推测你想要的一切。

我将 Sass (SCSS) 与 Compass 和 jQuery 以及我自己的 JavaScript 框架一起使用。

4

1 回答 1

0

As of today, CSS does not support positioning elements relative to mouse pointer.

So if you're not satisfied with cursor: url('pointer.cur') (thanks @ilya-streltsyn), then JavaScript is the only solution for you.

Or maybe you shouldn't do that in the first place. When an SWF uses a custom cursor, this freaks me out a lot.

于 2013-07-05T11:46:28.173 回答