我想使用超大全屏背景Supersized
但我想有滑块只在网站的右半部分,在左边我想有我的内容。当我滚动时,内容应该会移动,而背景会保持不变。就像这里:example site
有谁有主意吗?
编辑:好的,我知道了,但是我怎么才能让图像响应呢?有可能吗?
发布于 2015-01-12 20:23:23
.supersized {position:fixed;width:50% top:0;bottom:0;}发布于 2015-01-12 20:23:35
如果你使用dev工具浏览,你会看到:
#supersized {
position: fixed;
right: 0;
top: 0;
overflow: hidden;
z-index: -999;
height: 100%;
width: 50%;
}发布于 2015-01-12 21:16:43
包含内容的DIV应该有一个溢出卷轴:
<style>
.content{
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 50%;
overflow: scroll;
}
.the-bg{
background-image: ...;
background-size: cover;
position: absolute;
left: 50%;
top: 0;
bottom: 0;
width: 50%;
}
</style>
<div class="content">lorem ipsum</div>
<div class="the-bg"></div>或者,你可以把右边的放在固定的位置:
<style>
.content{
float: left;
width: 50%;
}
.the-bg{
background-image: ...;
background-size: cover;
position: fixed;
left: 50%;
top: 0;
bottom: 0;
width: 50%;
}
</style>
<div class="content">lorem ipsum</div>
<div class="the-bg"></div>https://stackoverflow.com/questions/27901803
复制相似问题