我对编码有点新。我有一个背景图像的div。当我向下滚动时,我希望能够将图像从其模糊的版本更改为更清晰的版本。我的HTML代码是这样的:滚动时更改图片
<div class="intro">
<div class="blur" style="background-image: url("blurimage.png");"></div>
<div class="clear" style="opacity: 0.00666667; background-image: url("image.png");"></div>
</div>
我的CSS代码是这样的:
.intro{
display: table;
width: 100%;
height: 700px;
position: relative;
}
.blur{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
z-index: -10;
background-color: #222;
}
.clear{
background-size: cover;}
我已经用很多JavaScript函数,但无济于事尝试。请指导我如何使用Javascript功能来做到这一点。 谢谢!
[CSS滚动背景模糊]的可能重复(http://stackoverflow.com/questions/20697004/css-background-blur-on-scroll) – Iceman