我對編碼有點新。我有一個背景圖像的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