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

240
Visualizações
When scrollTop 0 how to scroll up

I wanna impl android wheel time picker in js

I find this demo: https://demo.mobiscroll.com/jquery/datetime/gregorian-jalali-hijri#

see my gif, the demo scroll view scrollTop always 0, but in my draft code, scrollTop cannot scroll up, so when scrollTop 0, what's mechanism in this demo to scroll up

enter image description here

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

0

Whenever a user scrolls, it affects an elements scrolling box. windows.scrollTo() will affect the scrolling box of the uppermost containing block. This affects people call it scrolling the window or document.

about 4 years ago · Juan Pablo Isaza Relatório

0

I find the tmp solution

when scrollTop 0, scroll view event "scroll" doesn't trigger, event "wheel"(mouse wheel scroll up) and "touchmove"(mobile drag to scroll up) still work

following is my code using event "wheel"

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <!--mobile friendly-->
  <meta name="viewport" content="width=device-width, user-scalable=yes">
  <style>
    .c0 {
      height: 500px;
      display: flex;
      justify-content: center;
      align-items: center;
      background-color: lightblue;
    }

    .c {
      top: 50%;
      width: 100%;
      height: 300px;
      border: 5px solid black;
      overflow-y: auto;
    }

    .inner {
      background-color: pink;
      margin-top: 0px;
      width: 100%;
      user-select: none;
      height: 1000px;
    }
  </style>
</head>
<body>
<div class="c0">
  <div class="c">
    <div class="inner">inner</div>
  </div>
</div>

<script type="module">
  var c = document.querySelector(".c")
  var inner = document.querySelector(".inner")
  var startY
  inner.addEventListener("wheel", (ev) => {
    console.log("wheel")
    inner.style.marginTop = `${inner.offsetTop + ev.deltaY}px`
  })
</script>
</body>
</html>
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