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

99
Visualizações
Custom Scrollbar not working with Scrollsnapping

i have a problem with my scrollsnapping coming in the way of my custom scrollbar. As soon as i uncomment the scrollsnaping (commentet it, so you see how it should look like, but with scroll snapping on :) ) in my container the custom scrollbar is not working anymore. Somehow they dont get along with each other, while on their own they work.

If someone has any clue how to fix it let me know :).

Have a great weekend

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
::-webkit-scrollbar {
  width: 0;
}
#scrollpath {
  z-index: 1;
  position: fixed;
  top: 0;
  right: 0;
  width: 10px;
  height: 100%;
  background: #3D3D3D;
}
#progressbar {
  z-index: 1;
  position: fixed;
  top: 0;
  right: 0;
  width: 10px;
  height: 0%;
  border-radius: 10px;
  background: #000;
}
body {
  width: 100vw;
  height: 100vh;
  margin: 0;
  background: #000;
}
.container {
  width: 100%;
  height: 100%;
  # scroll-snap-type: y mandatory;
  # overflow-y: scroll;
}
section {
position: relative;
  width: 100%;
  height: 100vh;
  padding: 200px 20vw;
  display: flex;
  justify-content: center;
  align-items: center;
  scroll-snap-align: start;
}
.test {
  position: absolute;
  width: 100%;
  height: 100vh;
  background: #fff;
}
<html>
  <body>
    <div id ="scrollpath"></div>
    <div id ="progressbar"></div>
    <div class = "container">
      <section>
      </section>
      <section>
        <div class="test" id="test">
        </div>
      </section>
      <section>
      </section>
     </div>
     <script type="text/javascript">
        let progress = document.getElementById('progressbar');
        let totalHeight = document.body.scrollHeight - window.innerHeight;
        window.onscroll = function(){
          let progressHeight = (window.pageYOffset / totalHeight) * 100;
          progress.style.height = progressHeight + "%";
        }
     </script>
  </body>
</html>

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