更改指针,已更改默认光标后 [英] Changing Pointer, after already changing default cursor

查看:32
本文介绍了更改指针,已更改默认光标后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个风格化的页面,并且已经更改了默认光标,但是当您将鼠标悬停在链接上时,它会返回到标准的指针".我想像使用默认光标一样更改标准指针.我尝试了一些我发现的 javascript,但似乎没有用.

I'm creating a stylized page, and have already changed the default cursor, but it goes back to the standard "pointer" when you mouse over a link. I want to change the standard pointer as I did with the default cursor. I tried some javascript that I found, but it didn't seem to work.

    <!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="../css/basic.css">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<script>
    var elms = document.getElementsByTagName("*");
    var n = elms.length;
    for(var i = 0; i < n; i ++) {
        if(window.getComputedStyle(elms[i]).cursor == "pointer") {
            elms[i].style.cursor = "url(../img/cursor.png)";
        }
     }
</script>

</head>
<body>
      <a>
      <a>
</body>  
</html>

这是 CSS 光标

    html{
    min-width: 100%;
    min-height:100%;
    cursor: url(../img/cursor.png),auto;
}
body{
    background-color: black;
    cursor: url(../img/cursor.png),auto;
  }

推荐答案

试试这个:

a:hover, a:active, a:visited {
    cursor: url(../img/cursor.png), auto;
}

演示

P.S:在演示中使用了随机图像.

P.S: Used a random image in the demo.

这篇关于更改指针,已更改默认光标后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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