title: How do I make `window.scrollTo` more precise?
body: <p>When I click on <code>box1</code>, the scroll effect needs to scroll down to <code>box2</code> (top edge of the blue box). This works fine on web, but I'm not able to replicate the effect at a precise point on mobile.  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.getElementById('box1').addEventListener('click', function() {
    window.scrollTo({
      top: 507,
      behavior: "smooth"
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.box1 {
    width: 100px;
    height: 100px;
    background-color: red;
  }
  
  .box2 {
    width: 100px;
    height: 100px;
    background-color: blue;
  }
  
  .box3 {
    width: 100px;
    height: 100px;
    background-color: green;
  }
  
  .gap {
    width: 100%;
    height: 400px;
    background-color: yellow;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  
  &lt;head&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /&gt;
    &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div class="box1" id="box1"&gt;&lt;/div&gt;
    &lt;div class="gap"&gt;&lt;/div&gt;
    &lt;div class="box2" id="box2"&gt;&lt;/div&gt;
    &lt;div class="gap"&gt;&lt;/div&gt;
    &lt;div class="box3" id="box3"&gt;&lt;/div&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>When clicking on <code>box1</code> in an IPhone simulator, <code>scrollTo</code> takes me to the bottom half of the yellow box.</p>
  
  <p><a href="https://i.stack.imgur.com/hYgc4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hYgc4.png" alt="enter image description here"></a></p>