更改网页上鼠标光标的热点
我想更改鼠标指针的热点(我们已使用 .cur 文件更改了图标),使其位于图像的右下角,而不是左上角。
就像倒箭头光标一样,设计师/老板想出了一个几乎需要这个的漂亮设计。
是否可以更改网页上鼠标光标的热点?
I would like to change the hotspot of a mouse pointer, which we've changed the icon using a .cur file, to be in the bottom right of the image, rather then the top left.
Pretty much like an inverted arrow cursor, the designers/boss have come up with a nice design which almost requires this.
Is it possible to change the hotspot of a mouse cursor on a web page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我还没有测试它,从 developer.mozilla.org 获取它:
支持 CSS3 语法Gecko 1.8beta3 中添加了光标值; 因此它可以在 Firefox 1.5 中运行。 它允许指定光标热点的坐标,该坐标将被限制在光标图像的边界。 如果未指定,则将从文件本身读取热点坐标(对于 CUR 和 XBM 文件)或将其设置为图像的左上角。 CSS3 语法的示例如下:
链接到 CCS3 光标
I have not tested it, got it from developer.mozilla.org:
Support for the CSS3 syntax for cursor values got added in Gecko 1.8beta3; it therefore works in Firefox 1.5. It allows specifying the coordinates of the cursor's hotspot, which will be clamped to the boundaries of the cursor image. If none are specified, the coordinates of the hotspot are read from the file itself (for CUR and XBM files) or are set to the top left corner of the image. An example of the CSS3 syntax is:
Link to CCS3 cursor
这是不可能的,我很高兴 - 我认为你只会让你的用户感到沮丧。
编辑:我错了 - 我认为这是不可能的 - 但我仍然认为你不应该这样做。
It's not possible, and I'm glad - I think you'd only frustrate your users with this.
Edit: I was wrong - I didn't think this was possible - I still don't think you should do it though.
你不能。 正如这里的大多数人一样,我会告诉你即使可以也不要这样做......
但是,我可以想象这样的事情对于非常具体的情况,例如某些艺术家的页面,或者游戏光标,或者某种类似 3D 的地图,光标指向下方。 现在,如果您确实需要一个面向媒体的网站(而不是信息网站)的特殊光标,我会使用空白光标文件隐藏光标,并使用一些 Javascript 在光标上附加浮动图像,这样它“看起来像“热点在其他地方。
当然,您的网站的可用性和兼容性会大大下降,但上面的解决方案是如果您确实需要发挥创意自由,并且您的用户对此类内容持开放态度。
You can't. And as most people here I'd tell you to not do it even if you could...
However, I could imagine something like this for very specific cases like the page of some artist, or for a game cursor, or a sort of 3D-like map with the cursor pointing down. Now if you really need a special cursor for a media oriented site, as opposed to an information site, I'd hide the cursor, with a blank cursor file and use some Javascript to attach a floating image over the cursor so it "looks like" the hot spot is someplace else.
Of course your sites usability and compatibility will go way down, but the solution above is if you really need to take the creative liberty, and your users are open minded to this sort of stuff.