我這裏有一個網站...如何在滾動時消失的同時保持圖像不變?
http://matiny.tk/warframe/about/index.html
滾動時接近底部,可以看到鋪在上面有字符的圖像的頂部爲.png蓮花圖像。然後你繼續滾動,蓮花圖片滾動。我想要的是蓮花圖像在頂部到達窗口頂部時(當它處於完美的全景視圖中)時,它會鎖定在原位。在這一點上,滾動應該使其褪色,而不是移動。
我在想我可能會把它定位:固定然後用jQ使它不可見,直到它到達正確的點,然後使其淡入滾動。
中的有關內容的大型簡單...
<div class="char-div">
<img src="http://matiny.tk/warframe/about/lotus.png" alt="" class="lotus"/>
</div>
.char-div {
position: relative;
background-image: url(http://matiny.tk/warframe/about/chars.jpg);
background-size: cover;
background-position: center center;
background-attachment: fixed;
height: 1500px;
}
.lotus {
width: 100%;
position: absolute;
top: 0;
}
謝謝。我必須問,基於百分比滾動的代碼的最後一行是什麼? – Matiny
nope它是基於圖像卡在頁面頂部後滾動的像素 –