【发布时间】:2014-07-08 04:10:08
【问题描述】:
我正在创建一个风格化的页面,并且已经更改了默认光标,但是当您将鼠标悬停在链接上时,它会回到标准的“指针”。我想像使用默认光标一样更改标准指针。我尝试了一些我发现的 javascript,但它似乎不起作用。
<!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;
}
【问题讨论】:
-
你能发布整个img链接吗?
-
这是你的意思吗?
file:///J:/Graphic/webfolio/img/cursor.png
标签: javascript html css