jQuery 增加 HTML 正文中的光标大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27351916/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 11:23:52  来源:igfitidea点击:

Increase cursor size in HTML body

jqueryhtmlcsscursor

提问by ??eall?

Is there any way to programmatically increase the size of the cursor in a browser based application using CSSor jQuery?

有什么方法可以使用CSSjQuery以编程方式增加基于浏览器的应用程序中的光标大小?

I can change the type of cursor with CSS like so...

我可以像这样使用 CSS 更改光标的类型...

body {
    cursor: crosshair;
}

but I see no provision in CSS to increase the size of the cursor.

但我在 CSS 中没有看到增加光标大小的规定。

回答by Nasir Mahmood

there is no property regarding size of cursor but still you can use custom cursors, the trick behind this is to hide real cursor while show custom image. You can find more about this here Create Custom cursors

没有关于光标大小的属性,但您仍然可以使用自定义光标,这背后的技巧是在显示自定义图像时隐藏真实光标。您可以在此处找到有关此的更多信息Create Custom cursors

edit:above link is dead, it's still found on wayback machine: https://web.archive.org/web/20170605131602/http://www.ajaxblender.com/howto-create-custom-image-cursors.html

编辑:上面的链接已死,它仍然在回程机器上找到:https://web.archive.org/web/20170605131602/http: //www.ajaxblender.com/howto-create-custom-image-cursors.html

回答by ssilas777

You can't increase the size of the default cursor using CSS or jQuery.

您不能使用 CSS 或 jQuery 增加默认光标的大小。

But you can replace the cursor with the custom image of any size using pure CSS by cursor:Url()property.

但是您可以使用纯 CSS 通过cursor:Url()属性将光标替换为任意大小的自定义图像。

This is pure CSS and no need of Javascript/jQuery hack for this.

这是纯 CSS,不需要 Javascript/jQuery hack。

For more info: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor/url

更多信息:https: //developer.mozilla.org/en-US/docs/Web/CSS/cursor/url