【发布时间】:2014-06-04 12:18:40
【问题描述】:
好的,所以我一直在寻找一种简单的方法来在用户将 div 滚动到视图中时淡入它,但我找不到直接的解决方案。
HTML
<div class="container">
<div class="topdiv">This is a 100% height div. User scrolls down from here.</div>
<div class="fadethisdiv">This content should be faded in
once .fadethisdiv is [so many]px into the bottom of the viewport.
Let's use 150px as an example.</div>
</div>
CSS
.container {
width:100%;
height:600px;
}
.topdiv {
height:100%;
background-color:#09f;
text-align:center;
font-size:24px;
}
.fadethisdiv {
height:100%;
background-color:#36afff;
text-align:center;
font-size:24px;
}
JS
// Talk to me.
这是一个小提琴:http://jsfiddle.net/kz2z5/2/
【问题讨论】:
标签: jquery html scroll fadein opacity