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

84
Visualizações
Using main scrollbar to scroll inner div then scroll rest of page

I have a container div right-col inside of my hero div, that holds two inner divs. The inner divs are sticky and the container div is scrollable to give the illusion of cards sliding up.

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>
<body>
    <div class="hero">
        <div class="left-col">h</div>
        <div class="right-col">
            <div class="top">1st card</div>
            <div class="bottom">2nd Card</div>
        </div>
    </div>
    <div class="projects">a</div>
    <div class="contact-footer"></div>
    <div></div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">

</script>
</html>

CSS:

body{
    overflow: auto;
    background-color: black;
}
.hero {
    display: flex;
    flex-direction: row;
}

.left-col{
    width: 40vw;
    background-color: black;
    height: 100vh;
}
.right-col{
    min-width: 60vw;
    background-color: blue;
    overflow: auto;
    height: 100vh;
}
.top{
    height: 100vh;
    background-color: chartreuse;
    position: sticky;
    top: 0;
}
.bottom{
    height: 100vh;
    background-color: orange;
    position: sticky;
    top: 10%;
}

.projects{
    height: 100vh;
    background-color: crimson;
    position: sticky;
    top: 0;
}

However, the scroll bar is on the inside of the div right-col and independent from the main scrollbar. Is there a way that I can use the main scrollbar to scroll through the container div till it reaches the bottom then continues to scroll through the rest of the page? Possibly using js or jquery?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You could try adding the following css. It will make the inner scroll bar 0 width, so basically it will be invisible but still work.

.hero ::-webkit-scrollbar {
  width: 0px;
}

If you need something more specific you could try using the scroll event to possibly synchronize both scroll bars or something.

about 4 years ago · Juan Pablo Isaza Relatório
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