【发布时间】:2011-12-03 09:19:19
【问题描述】:
HTML 代码:
<div id="img-wrapper">
<img src="images/1.png" title="Picture 1" class="my-img" />
<img src="images/2.png" title="Picture 2" class="my-img" />
<img src="images/3.png" title="Picture 3" class="my-img" />
</div>
样式:
#img-wrapper {
position: relative;
width: 200px;
height: 100px;
}
.my-img {
display: none;
position: absolute;
top: 0;
left: 0;
}
我使用 jquery 来旋转图像(效果很好)。但我希望在此图像上方显示文本。我确实尝试在 img-wrapper 的底部包含一个 DIV。但是该文本显示在图像后面。我使用fadeIn() 和fadeOut() 在旋转时显示图像。
如何在图片上方放置一个div?
编辑
我对代码做了一些更改。我现在正在使用 Cycle 插件根据这个问题的答案显示图像:jQuery - Image rotation gets faster when focused after the focus was on another Chrome Tab
现在,我以前显示文本的解决方案不起作用! :(
编辑
上述问题的解决方案:使用更高的 z-index 值。
【问题讨论】:
-
您可以在 jquery 中使用硬币滑块插件检查它workshop.rs/2010/04/…