【发布时间】:2013-05-30 15:26:13
【问题描述】:
这是我的 Jquery 代码:
$(document).ready(function () {
$('.caption').hide();
$('.replaybox', this).hover(function () {
$('.caption', this).stop().animate({
opacity: 1,
height: 30
}, 200);
}, function () {
$('.caption', this).stop().animate({
opacity: 0,
height: 0
}, 200);
});
$('span').click(function () {
$('.div', this).slideToggle();
});
});
现在当我的鼠标悬停在.replaybox 上时我想要什么,所以.caption div 高度是动画 30 像素。我现在将跨度放在.caption 类中,当我单击跨度时,.div 类是切换的,那时.replaybox 溢出是隐藏的,所以我的.div 框隐藏在主类中,所以我该如何显示顶部与高度和与。
HTML 代码是野兔:
<div class="replaybox">
<div class="caption">
<span>
<img src="coffe.png"/>
<div class="div"></div>
</span>
<span>
<img src="emotion.png"/>
<div class="div"></div>
</span>
<span>
<img src="podcast.png"/>
<div class="div"></div>
</span>
<span>
<img src="cog.png"/>
<div class="div"></div>
</span>
</div>
</div>
您还可以在此链接中看到: http://jsfiddle.net/Abhinav/yYW9C/7/
【问题讨论】:
-
嗨@user,欢迎来到SO。反引号 ` 将执行内联代码。