将鼠标上的鼠标移到锚样式 [英] Change the mouse cursor on mouse over to anchor-like style

查看:241
本文介绍了将鼠标上的鼠标移到锚样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我将鼠标悬停在 div 上,鼠标光标将变为类似HTML锚点的光标。

If I hover the mouse over a div the mouse cursor will be changed to the cursor like that in HTML anchor.

我该如何做?

推荐答案

假设您的 div id =myDiv,请将以下内容添加到CSS。 cursor:pointer 指定光标应该是用于锚点(超链接)的同一手形图标:

Assuming your div has an id="myDiv", add the following to your CSS. The cursor: pointer specifies that the cursor should be the same hand icon that is use for anchors (hyperlinks):

添加CSS

#myDiv
{
    cursor: pointer;
}

您可以简单地将光标样式添加到 div 的HTML如下:

You can simply add the cursor style to your div's HTML like this:

<div style="cursor: pointer">

</div>

编辑

如果您决定使用jQuery,请将以下行添加到您的 $(document).ready()或正文 onload :(用 div 的所有类别替换 myClass

If you are determined to use jQuery for this, then add the following line to your $(document).ready() or body onload: (replace myClass with whatever class all of your divs share)

$('.myClass').css('cursor', 'pointer');

这篇关于将鼠标上的鼠标移到锚样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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