Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

121
Visualizações
javascript- transitioning through array of backgroundcolors on scroll for a single section

I'm trying to transition between background colors in a single section so that when a specific section (.bg_container) hits the top of the viewport the background color starts starts to smooth transition while scrolling. I've seen many examples of very nice background fades/transitions but they all assume that each section has it's own color.

The issue here is that i have more colors than sections, so i can't tie the background color to sections.

<script>
    
    var bg_colours = [
      "#f0f0ff",
      "#ff00ff",
      "#0ff00f",
      "#ffffff",
      "#000000",
    ];
    
</script>

<div class="main">
    
    <div class="header">
        <span>lorum ipsom</span>
    </div>
    
    <div class="module_one">
        <p>lorum ipsom</p>
    </div>
    
    <div class="module_two bg_container">
        <div class="bg_section height_100_percent">
            <div class="left_content">
                <p>lorum ipsom</p>
            </div>
            <div class="right_content">
                <p>lorum ipsom</p>
            </div>
        </div>
        <div class="bg_section height_100_percent">
            <div class="left_content">
                <p>lorum ipsom</p>
            </div>
            <div class="right_content">
                <p>lorum ipsom</p>
            </div>
        </div>
    </div>
    
    <div class="module_three">
        <p>lorum ipsom</p>
    </div>
    
    <div class="footer">
        <p>lorum ipsom</p>
    </div>
    
</div>

in the above sample i want to transition the background color for bg_container using a color array.

Thank you for your time!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda