jQuery新手!
我在使用Cycle插件更改div的背景图像而不是在幻灯片中循环时遇到了麻烦。我的div有其他内容,我不想改变。
我是否应该使用其他插件来实现此目的?对此非常感激。
答案 0 :(得分:1)
答案 1 :(得分:1)
简化Marshall建议的方法:http://jsfiddle.net/petarsubotic/299Wr/
CSS
#wrapper {
position: absolute;
overflow:hidden;
height: 333px; /* optional */
background: black; /* optional */
}
#content {
position:relative;
z-index:999;
float:left;
background: rgba(0, 0, 0, 0.8); /* optional */
padding:1em; /* optional */
margin: 1em; /* optional */
color:white; /* optional */
}
#bg_containers {
position:absolute;
}
HTML
<div id="wrapper">
<div id="content">
The background image behind this can be any size, so although it may not cover your entire screen in this case, you can make it cover as much or as little of the screen as you like. Just adjust the size of the #bg_containers, and of course, you can also have the background tile if you like as well.
</div>
<div id="bg_containers" >
<div><img src="http://www.australia.com/contentimages/about-landscapes-nature.jpg"/> </div>
<div><img src="http://www.mtsu.edu/urban/images/urban1.jpg"/></div>
</div>
</div>