locomotivemtl / locomotive-scroll

🛤 Detection of elements in viewport & smooth scrolling with parallax.
https://locomotivemtl.github.io/locomotive-scroll
MIT License
7.56k stars 1.11k forks source link

sticky always on top ? #430

Closed cyrillebrotto closed 2 years ago

cyrillebrotto commented 2 years ago

Hello here's my problem: I have two sections with accordions inside. The title of my sections is sticky. When I collapse an accordion menu of the section-one, then I scroll : the title of the section-two does not stick to the top of the page but to the bottom of the section-one which has just expanded.

How to stick it to the top of the page?

Thank you for your answers.


<section id="section-one">
            <h1 data-scroll data-scroll-sticky data-scroll-target="#section-one">TITLE 1</h1>         

            <!-- ACCORDION -->
            <div class="accordion" >
                ...
            </div>
            <!-- END ACCORDION -->
  </section>

  <section id="section-two">
      ...
            <h1 data-scroll data-scroll-sticky data-scroll-target="#section-two">TITLE 2</h1>
            <!-- ACCORDION -->
            <div class="accordion" >
                ...
            </div>
            <!-- END ACCORDION -->
   </section>
cyrillebrotto commented 2 years ago

Cleaning code and that's it :)