A
A
Arseniy2020-05-07 16:50:13
JavaScript
Arseniy, 2020-05-07 16:50:13

How to change the styles of a sticky block after it scrolls through a certain block?

There is a page with a sticky-element block that sticks when scrolling. Is it possible somehow during the scroll, as soon as the sticky block passes the entire sticky-container block, add a class to the sticky-element?

<div class="container">
  <div class="block"></div>
  <div class="sticky-container">
    <div class="sticky-element">Прилипающий блок</div>
    <! -- после того как этот блок будет проскроллен, к sticky-element надо добавлять класс -->
    <div class="something-content"></div>
  </div>
  <div class="block"></div>
  <div class="block"></div>
</div>


Here is a link with the same code example:
https://jsfiddle.net/arsenij00/4n3j1r2t/17/

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question