Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!