【发布时间】:2019-01-17 00:23:24
【问题描述】:
我是网站设计新手,有一个问题想问。我尝试使用velocity.js 来实现这一点,但失败了。我确信有一个相当简单的 css 解决方案可以满足我的需求。我只希望前一个 div “淡入”,而滚动到的新 div 以更大的不透明度淡入。也可以使用任何 jQuery 示例。
这是我的相关部分的代码:
html:
<section id="services">
<h2 class="pb-5">Services We Offer</h2>
<div id="service1">
<h2>Service 1</h2>
</div>
<div id="service2">
<h2>Service 2</h2>
</div>
<div id="service3">
<h2>Service 3</h2>
</div>
</section>
css:
#services{
}
#service1{
height: 100vh;
background-color: rgb(44, 49, 90);
}
#service2{
height: 100vh;
background-color: #267481;
}
#service3{
height: 100vh;
background-color: #373f24;
}
【问题讨论】:
-
您不能在 css 中使用滚动事件。这个问题可能对你有帮助stackoverflow.com/questions/8755887/…
标签: javascript jquery html css animation