我正在使用带有多个 div 作为背景(部分)的 backstretch jquery 插件。目前我使用的是固定高度,但我希望 div 是窗口的 100% 高度并且页面是可滚动的。我怎样才能做到这一点?
HTML
<div class="main-container"></div>
<div class="main-container2"></div>
<div class="main-container3"></div>
<div class="main-container4"></div>
CSS
.main-container {
background-image:url(../images/footballfieldblur.jpg);
height:1000px;
z-index:-100;
}
.main-container2 {
background-image:url(../images/orange3.png);
height:1000px;
}
.main-container3 {
background-image:url(../images/lightbackground.jpg);
height:1000px;
}
.main-container4 {
background-image:url(../images/diamondplatebackground.jpg);
height:1000px;
}
JAVASCRIPT
<script>
$(".main-container").backstretch("images/footballfieldblur.jpg");
$(".main-container2").backstretch("images/orange3.png");
$(".main-container3").backstretch("images/lightbackground.jpg");
$(".main-container4").backstretch("images/diamondplatebackground.jpg");
</script>