Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/447.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何根据元素更改光标_Javascript_Html_Css - Fatal编程技术网

Javascript 如何根据元素更改光标

Javascript 如何根据元素更改光标,javascript,html,css,Javascript,Html,Css,我创建了一个静态网站,我有自己的自定义光标集,我想实现 默认设置为cursor:url('*filepath*/normal.cur') 然后对于textcursor:url('*filepath*/textselect.cur') 对于链接cursor:url('*filepath*/links.cur') 加载时,光标:url('*filepath*/loading.ani') 如何正确实现此功能?将要更改光标的元素指定为类,并在其上设置:hover属性,并相应地更改光标: 前 .div2:

我创建了一个静态网站,我有自己的自定义光标集,我想实现

默认设置为
cursor:url('*filepath*/normal.cur')

然后对于text
cursor:url('*filepath*/textselect.cur')

对于链接
cursor:url('*filepath*/links.cur')

加载
时,光标:url('*filepath*/loading.ani')


如何正确实现此功能?

将要更改光标的元素指定为类,并在其上设置
:hover
属性,并相应地更改光标:

.div2:悬停{
游标:url('http://www.rw-designer.com/cursor-view/126124.png汽车,;
}

工作

为所有标记赋予不同的ID,然后使用hover属性在每个元素上添加游标属性

<a id="loading">Loading</a>
#loading {cursor: -webkit-grab; cursor: grab;}
加载
#正在加载{cursor:-webkit-grab;cursor:grab;}