我有一个使用 100% 宽度和高度来实现全屏图像样式的网页。但是,我希望这些 div 并排放置,当我单击一个按钮时,它会切换到下一张或上一张幻灯片。你觉得我怎么能做到这一点?
这是轮播代码:
<div class="page-carousel">
<div class="page page-01" style="background: url(images/01.jpg);">
<div class="page-text">
<h1>Headline</h1>
<h2>Subheader</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
</div>
</div>
<div class="page page-02" style="background: url(images/02.jpg);">
<div class="post-text">
<h1>Headline</h1>
<h2>Subheader</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
</div>
</div>
</div>
和CSS:
.page-carousel{
height: 100%;
width: 100%;
}
.page{
height: 100%;
width: 100%;
background: no-repeat bottom center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
position: relative;
float: left;
z-index:0;
}
提前致谢!