尝试以与FlexSlider网站主页上显示的方式相同的方式配置FlexSlider。 =)
http://www.woothemes.com/flexslider/
使用透明背景的图像上有字幕。
以下代码有效,除了导航控件 - 它们一直向下移动。
CSS:
#homepage-images img {
display: block;
height: 350px;
}
#homepage-images li {
position: relative;
}
#homepage-images .flex-caption {
position: absolute;
bottom: 0;
left: 0;
margin: 0;
padding: 10px;
color: white;
background-color: rgba(0,0,0,0.5);
}
HTML:
<div id='homepage'>
<div id='homepage-images' class='flexslider'>
<ul class='slides'>
<li><img src='content/homepage/images/1.jpg' alt=''><p class='flex-caption'>Some captions</p></li>
<li><img src='content/homepage/images/2.jpg' alt=''><p class='flex-caption'>Some more captions</p></li>
</ul>
</div>
</div>
JS:
$(document).ready(function() {
$('#homepage-images').flexslider({
animation: 'slide',
slideshowSpeed: 3000,
controlsContainer: ".flex-container",
});
});
答案 0 :(得分:3)
您已将所有LI元素设置为position: relative
。使用更具体的选择器:
http://jsfiddle.net/isherwood/aMDLP/2/
#homepage-images .slides li {
position: relative;
}