游标256x256像素大小 [英] cursor 256x256 px size

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

问题描述

我遇到了尝试创建自定义光标的问题。主要问题是光标大小 - 256x256px PNG(transparent)图像。问题产生于各种限制,浏览器和操作系统。 (我上一个问题解释为什么CSS cursor {} 不会工作

正如你已经知道的,你不能有一个自定义的光标:Windows有32x32像素的限制。 >

如果你想要更大的,你需要使用一个DOM元素包含你的光标图像,并让它跟随光标。



这是相对直接的(特别是如果你使用JQuery)。



这里有一个如何做的讨论: Jquery - 按照光标的DIV 如何使用jquery跟踪你的鼠标指针? p>

但是,请注意,与使用真实光标相比,此方法将有一些限制。



我可以直接想到的是:




  • 动画可能不会像你实际的光标移动一样快,滞后效应。


  • 当您碰到浏览器窗口的边缘时,您可能会遇到问题。在左边和上边缘,很容易将光标图像部分移动到边缘上,但在右边和底部,这样做可能会导致浏览器认为页面大小已更改,并生成不需要的滚动条。 p>



I've got stuck with trying to create a custom cursor. The main problem is the cursor size – 256x256px PNG (transparent) image. The problem arises from various limitations, browser and OS. ( my previous question explains why CSS cursor {} won't work stackoverflow )

So, what are the alternatives to CSS to have a custom cursor?

解决方案

As you already know, you cannot have a custom cursor that big: Windows has a limitation of 32x32 pixels.

If you want bigger than that, you'll need to use a DOM element containing your cursor image, and get it to follow the cursor.

It's relatively straightforward (especially if you do it with JQuery).

There's a discussion of how to do it here: Jquery - Follow the cursor with a DIV and How do you make a picture follow your mouse pointer with jquery?

However, please note that there will be limitations to this approach compared with having a real cursor.

The two issues I can think of straight away are:

  • The animation may not react as quickly as your actual cursor movements, resulting in a possible lagging effect.

  • and you may have issues when you hit the edge of the browser window. On the left and top edges, it's easy to just move the cursor image partially over the edge, but on the right and bottom, doing that could cause the browser to think the page size has changed, and to generate unwanted scroll bars.

这篇关于游标256x256像素大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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