在反应中指定自定义光标

时间:2021-03-28 11:28:43

标签: reactjs

我想在用户将鼠标移到 .我可以指定系统默认游标,这很好用,但我不能让自定义游标工作;

import CustomCursor from '../custompointer.svg';
...
<div style={{ cursor: 'url(' + CustomCursor + ', auto)' }}>

我在网上看到了一些解决方案,但对于我认为是一个简单的解决方案来说,这些解决方案很冗长。

1 个答案:

答案 0 :(得分:0)

更改您的代码:

cursor: 'url(' + CustomCursor + ', auto)'

cursor: "url(" + CustomCursor + "), auto"

Demo