如何在悬停时更改图像名称(数字)?从“图片”到“ picture01” ...“ picture10” .jpg

问题描述 投票:0回答:1

如何在悬停时更改图像名称(数字)?从“图片”到“ 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>
javascript html
1个回答
0
投票

您可以使用鼠标悬停在js中的事件侦听器上来跟踪悬停:

test.addEventListener("mouseover", function( event ) {   
  // change the src of the image here
  img.src = "file.png";

}, false);
© www.soinside.com 2019 - 2024. All rights reserved.