【发布时间】:2015-04-27 14:26:32
【问题描述】:
大家好,我正在尝试使用 skrollr.js (https://github.com/Prinzhorn/skrollr) 将两个图像的背景交换到我网站的页脚部分。由于某种原因,它根本不会滚动。我正在尝试创建一个在下面部分具有固定位置的视差站点。
查看图片:http://prntscr.com/6yrckx
这是该部分的标记:
<div id="starynight"
data-bottom-top="opacity: 1; background: !url(images/sunny.jpg); background-size: cover;"
data--40-top="opacity: 0.5; background: !url(images/night.jpg); background-size: cover;"
data--50-top="opacity: 0; background: !url(images/night.jpg); background-size: cover;"
data--60-top="opacity: 0.5; background: !url(images/night.jpg); background-size: cover;"
data--70-top="opacity: 1; background: !url(images/night.jpg); background-size: cover;"
>
</div>
这里是 CSS:
#starynight{
background: url('../images/sunny.jpg') no-repeat center;
width: 100%;
height: 307px;
background-size: cover;
}
#road{
background: url('../images/road.jpg') no-repeat center;
width: 100%;
height: 145px;
background-size:cover;
}
#car{
background: url('../images/car.png') no-repeat center;
width: 325px;
height: 125px;
display: block;
position: absolute;
z-index: 9999;
left: 950px;
top: 2100px;
}
我的问题是,当我滚动网站的这一部分时,它应该在汽车从右向左移动时交换 Sunny.jpg 和 night.jpg 的图像,并且这个背景图像必须固定在适当的位置。出于某种原因,我的代码不能正常工作。知道出了什么问题吗?
在这里查看我的网站:http://goo.gl/aNOCiJ
【问题讨论】:
标签: javascript html css skrollr