如何在悬停时更改图像名称(数字)?从“图片”到“ picture01” ...“ picture10” .jpg逐渐地,如果您删除光标,它将重置为原始图像,每个块都是独立的
<ul>
<li><a href="#"><img src="images/001/picture.jpg"</a></li>
<li><a href="#"><img src="images/002/picture.jpg"</a></li>
</ul>
您可以使用鼠标悬停在js中的事件侦听器上来跟踪悬停:
test.addEventListener("mouseover", function( event ) {
// change the src of the image here
img.src = "file.png";
}, false);