如何更改鼠标悬停时的div背景图像?
我有一些列表项,例如 -
<div class="smenu">
<ul>
<li ><a href="index.html"><img src="images/solution1.jpg" border="0"></a></li>
<li ><a href="#"><img src="images/solution2.jpg" border="0"></a></li>
<li ><a href="#"><img src="images/solution3.jpg" border="0"></a></li>
<li ><a href="#"><img src="images/solution4.jpg" border="0"></a></li>
<li ><a href="#"><img src="images/solution5.jpg" border="0"></a></li>
</ul>
</div>
当用户移动菜单项时我想更改背景图像(如果 DIV) -
<div class="hbg">
<!--here I want to display image-->
</div>
我如何通过 jQuery 做到这一点???
I have some set of list items like-
<div class="smenu">
<ul>
<li ><a href="index.html"><img src="images/solution1.jpg" border="0"></a></li>
<li ><a href="#"><img src="images/solution2.jpg" border="0"></a></li>
<li ><a href="#"><img src="images/solution3.jpg" border="0"></a></li>
<li ><a href="#"><img src="images/solution4.jpg" border="0"></a></li>
<li ><a href="#"><img src="images/solution5.jpg" border="0"></a></li>
</ul>
</div>
when user moves over the menu items I want to change the background image if DIV -
<div class="hbg">
<!--here I want to display image-->
</div>
how can I do this through jQuery???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我假设您打算使用
li
下图像的src
。I assume you intend to use the
src
of the image under theli
.你的意思是像下面这样?
You mean something like following?
使用 jquery 的
hover
函数例如:
use
hover
function of jqueryfor example:
我管理了以下内容:
重构它会很好,但只需将“颜色”替换为“图像”,它应该是一个可行的解决方案。
I managed the following:
It would be nice to refactor this, but just replace the "color" with "image", and it should be a working solution.