我创建了一个带有左箭头和右箭头的jquery滑块的网站,可以移动到下一张幻灯片(网页)。所有内容都包含在一个网页中,并使用散列。http://www.ilandeistudio.com
每个页面都需要不同的全屏背景(散列),所以我使用了一种CSS技术,它将全屏背景放置在我在这里找到的DIVs中(CSS技术1) http://css-tricks.com/perfect-full-page-background-image/。
这是可行的,但图像的高度是运行在屏幕底部,因此添加垂直滚动条,你不能看到整个背景图像。我不介意扭曲一些背景(它们都是w1024px x h682px),我只想在可视区域看到整个图像。
我还无法让它与CSS一起工作,如果有人有建议,请告诉我,否则可能有人会推荐jquery解决方案;但是,我不知道如何使大多数jquery示例在DIVs中用于多个散列。
下面是我现在使用的CSS:
img.bg {
/* Set rules to fill background */
min-height: 100%;
min-width: 1024px;
/* Set up proportionate scaling */
width: 100%;
height: auto;
/* Set up positioning */
position: absolute;
top: 0;
left: 0;
}
@media screen and (max-width: 1024px){
img.bg {
left: 50%;
margin-left: -512px; }
}下面是两张幻灯片的例子
<div id="home" class="slide">
<img src="images/bg_home1.jpg" class="bg">
<div class="outer-wrapper">
<div class="inner-wrapper">
<div class="header">
<a href="#home" class="special-anchor"></a>
<div class="nav">
<a href="#" class="prev-button special-anchor" title="Previous">Previous</a>
<span class="rightnav"><a href="#" class="next-button special-anchor" title="Next">Next</a></span>
</div>
</div>
<div class="content">
test content
</div>
<!--Content ends-->
</div>
</div>
</div>
<div id="about" class="slide">
<img src="images/bg_about1.jpg" class="bg">
<div class="outer-wrapper">
<div class="inner-wrapper">
<!--Header starts-->
<div class="header">
<a href="#about" class="special-anchor"></a>
<!--Navigation starts-->
<div class="nav">
<a href="#" class="prev-button special-anchor" title="Previous">Previous</a>
<span class="rightnav"><a href="#" class="next-button special-anchor" title="Next">Next</a></span>
</div>
<!--Navigation ends-->
</div>
<!--Content starts-->
<div class="content">
test content 02
</div>
<!--Content ends-->
</div>
</div>
</div>发布于 2013-01-06 02:00:37
代码本身看起来是正确的。有一件事您没有包括,但我要确保的是,您列出的标题和导航是绝对定位的在页面上,而不是浮动左,并使用空白处定位的东西。这将为页面的100%添加空间。
因此,图像本身正在扩展到页面的高度,而标题和导航的高度则被添加到页面的顶部。如果你似乎在滚动这些物体的高度,这很可能就是问题所在。
https://stackoverflow.com/questions/10222918
复制相似问题