HTML代码
1 2 3 4
| <a class="imgdiv" href="#gotop" title="返回顶部"> <img th:src="@{/static/images/top2.png}" id="gotop" alt="" class="imgsrc" style="position: fixed;bottom: 10%;display: none;height: 40px;margin-left: 96%"> </a>
|
JavaScript代码
1 2 3 4 5 6 7 8
| $(document).ready(function () { $(".imgdiv").mouseover(function(){ $(".imgsrc").attr("src","/static/images/top4.png"); }); $(".imgdiv").mouseout(function(){ $(".imgsrc").attr("src","/static/images/top2.png"); }); });
|
PS.
来源:JQuery鼠标移到图片改变,移出图片恢复原来图片_u014599700的专栏-CSDN博客