【发布时间】:2014-10-14 19:37:23
【问题描述】:
我正在创建一个团队部分。我有一个简单的
.hover() 轻松实现了这一点。但是,当我复制相同的代码时,猜猜它做了什么。是的,你们是对的:它向我展示了所有团队成员的信息。
我想要的只是一个一个地显示它们,当你停止悬停内容时返回到它们的初始状态。
我在下面留下我的 JS 代码:
<script type="text/javascript">
$('.teamMemberPhoto').hover(function(){
$('.teamMemberCircle').hide();
$('.teamMemberInfo').show();
});
</script>
编辑,添加 HTML:
<div class="teamMembersContainer">
<div class="teamMember">
<h3 class="teamMemberName">Sarei Arlin Rodriguez Camarillo</h3>
<p class="teamMemberPosition">Software Developer</p>
<div class="teamMemberBox">
<div class="teamMemberCircle" style="background: #52b3d9;">
<img class="teamMemberPhoto" src="../img/team/1.png" alt="Member" >
</div>
<div class="teamMemberInfo">
<h4 class="teamWhat">What I do in my job?</h4>
<p class="teamInfoContent">Software Development</p>
<h4 class="teamWhat"> Why I do what I do ?</h4>
<p class="teamInfoContent">Currently, I work in software development which is one of the most fulfilling things I have done and it has given me great personal and professional satisfaction.</p>
<h4 class="teamWhat">What I do for fun?</h4>
<p class="teamInfoContent">I have a great passion for the world of technology and telecommunications and love discovering and learning new about that realm.</p>
</div>
</div>
</div>
</div>
</div>
提前致谢。
【问题讨论】:
-
请分享 HTML 标记...
-
解决方案取决于您的 HTML 结构。另外,除非你有理由不这样做,否则我建议使用 CSS。
-
我已添加 HTML,希望对您有所帮助,谢谢。
标签: jquery hover jquery-hover