我有一个列表,并且有一个点击处理程序:
<ul>
<li>foo</li>
<li>goo</li>
</ul>
如何将鼠标指针更改为手指针(如悬停在按钮上)?现在,当我将鼠标悬停在列表项上时,指针变成了文本选择指针。
我有一个列表,并且有一个点击处理程序:
<ul>
<li>foo</li>
<li>goo</li>
</ul>
如何将鼠标指针更改为手指针(如悬停在按钮上)?现在,当我将鼠标悬停在列表项上时,指针变成了文本选择指针。
当前回答
使用HTML黑客
注意:不建议这样做,因为这被认为是不好的做法
将内容包装在包含href属性的锚定标记中,无需显式应用游标:指针;具有锚点财产副作用的属性(用CSS修改):
<a href=“#”style=“text-decoration:initial;color:inital;”><div>这是一种不好的做法,但它有效</分区></a>
其他回答
您不需要jQuery,只需使用以下CSS内容:
li {cursor: pointer}
瞧!方便的
CSS:
.auto { cursor: auto; }
.default { cursor: default; }
.none { cursor: none; }
.context-menu { cursor: context-menu; }
.help { cursor: help; }
.pointer { cursor: pointer; }
.progress { cursor: progress; }
.wait { cursor: wait; }
.cell { cursor: cell; }
.crosshair { cursor: crosshair; }
.text { cursor: text; }
.vertical-text { cursor: vertical-text; }
.alias { cursor: alias; }
.copy { cursor: copy; }
.move { cursor: move; }
.no-drop { cursor: no-drop; }
.not-allowed { cursor: not-allowed; }
.all-scroll { cursor: all-scroll; }
.col-resize { cursor: col-resize; }
.row-resize { cursor: row-resize; }
.n-resize { cursor: n-resize; }
.e-resize { cursor: e-resize; }
.s-resize { cursor: s-resize; }
.w-resize { cursor: w-resize; }
.ns-resize { cursor: ns-resize; }
.ew-resize { cursor: ew-resize; }
.ne-resize { cursor: ne-resize; }
.nw-resize { cursor: nw-resize; }
.se-resize { cursor: se-resize; }
.sw-resize { cursor: sw-resize; }
.nesw-resize { cursor: nesw-resize; }
.nwse-resize { cursor: nwse-resize; }
也可以将光标设置为图像:
.img-cur {
cursor: url(images/cursor.png), auto;
}
使用HTML黑客
注意:不建议这样做,因为这被认为是不好的做法
将内容包装在包含href属性的锚定标记中,无需显式应用游标:指针;具有锚点财产副作用的属性(用CSS修改):
<a href=“#”style=“text-decoration:initial;color:inital;”><div>这是一种不好的做法,但它有效</分区></a>
li:hover {cursor: hand; cursor: pointer;}
对于基本手符号:
Try
cursor: pointer
如果您想要一个手形符号,如拖动某个项目并将其放下,请尝试:
cursor: grab