title: Side panel to top. Is there any other solution?
body: <p>I'm trying to make button to top on the side panel. But I' facing a problem because I need my SIDE panel to act on scroll but not the whole body. There's the code for example:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  
  &lt;link rel="stylesheet" href="style.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="side"&gt;
  &lt;button onclick="topFunction()" id="topBtn" title="Go to top"&gt;Top&lt;/button&gt;
  
  &lt;div style="background-color:black;color:white;padding:30px"&gt;Scroll Down&lt;/div&gt;
  &lt;div style="background-color:lightgrey;padding:30px 30px 2500px"&gt;This example demonstrates how to create a "scroll to top" button that becomes visible when the user starts to scroll the page.&lt;/div&gt;
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;script type="text/javascript" src="js.js"&gt;&lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>const side = document.getElementById('side');
  const top = side.offsetTop;
  
  if (top &gt; 10){
      document.getElementById('topBtn').style.display = "block";
  } else {
    document.getElementById('topBtn').style.display = "none";
  }
  </code></pre>