jQuery.cycle更改div背景图片 [英] jQuery.cycle change div background image

查看:90
本文介绍了jQuery.cycle更改div背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery新手!

我在获取Cycle插件来更改div的背景图像而不是在幻灯片之间循环时确实遇到了麻烦.我的div还有其他我不想更改的内容.

I am having real trouble getting the Cycle plugin to change the background image of a div rather than cycle through slides. My div has other content which I don't want to change.

是否有另一个我应该用来实现此目的的插件?对此最有帮助的人.

Is there another plugin out there that I should be using to achieve this? Help most appreciated on this.

推荐答案

简化方法,马歇尔建议: http://jsfiddle.net/petarsubotic/299Wr/

Simplifying the method Marshall recommended: 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>

这篇关于jQuery.cycle更改div背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆