【发布时间】:2020-02-27 06:15:10
【问题描述】:
我正在尝试使用此帖子:Add/remove class with jquery based on vertical scroll? 但似乎无法让它与多个 div 一起使用,每个 div 都有自己的类,并且需要在距顶部不同距离处添加/删除 1 个类。 在高层次上,这是我想要发生的事情:
<div class="div-01">1 class added and 1 class removed when user scrolls down 500px from top and reverse if scrolling up</div>
<div class="div-02">1 class added and 1 class removed when user scrolls down 1000px from top and reverse if scrolling up</div>
<div class="div-03">1 class added and 1 class removed when user scrolls down 1500px from top and reverse if scrolling up</div>
【问题讨论】:
标签: javascript jquery html css