悬停时多个图像交换
大家好,我一直在寻找这个答案,但我的头很痛。
我有一个包含团队成员图像的页面,我希望当您将鼠标悬停在每个图像上时,会出现该团队成员的另一张图像。很简单,我可以使用每个成员的 css 来完成此操作,但想知道是否有一种使用查询的方法,以便可以通过文件名来完成,例如 dan.jp 和 dan-hover.jpg。
谢谢
Dan
编辑:我还希望当您将鼠标悬停在图像上时,原始图像会替换另一个图像,因此新图像仅在鼠标悬停在图像上时出现。
Hi Guys I have been looking around for this answer and my head hurts.
I have a page with team members' images and I want it to be such that when you hover over each image, another image of that team member appears. Simple, well I can do it with css for each member but was wondering if there is a way using query so that it can be done by the name of the files, e.g. dan.jp and dan-hover.jpg.
Thanks
Dan
EDIT: I would also like it to be such that when you hover off the image, the original image replaces the other image so the new image only appears while the mouse is hovering on the image.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需用户 .hover
Just user .hover
我想你需要这样的东西:
编辑: 仅更改特定图像,你可以(例如)执行以下操作:
将所有所需图像放入容器中
,然后将 jQuery 选择器更改为:
I guess you need something like this:
Edit: to change only specific images you can (for example) do this:
put all the desired images in a container
and then change the jQuery selector to:
关于这个主题确实有很多主题和例子。
例如,请看这里:
使用 jQuery 更改鼠标悬停时的图像源
There are really a lot of topics and examples on this subject.
For example, look here:
Change the image source on rollover using jQuery