开发者

jQuery.cycle change div background image

jQuery newbie!

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 do开发者_StackOverflow中文版n't want to change.

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


This page should help you:

http://www.magneticwebworks.com/jquery-rotating-page-background/


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜