title: How to handle window or body onscroll in Blazor server side?
body: <p>I need to capture <code>onscroll</code> event of <code>window</code> or <code>body</code> in my blazor server side application. Right now I implemented this using a script file where I capture the event and do my logics in there.</p>
  
  <p><strong>For <code>window</code>:</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>window.onscroll = function() {myFunction()};
  
  function myFunction() {
    //  ... my logics here
  }
  </code></pre>
  
  <p>How to capture <code>onscroll</code> event of <code>body</code> tag? In blazor server side <code>body</code> is in <code>_Host.cshtml</code> file where I cannot use <code>@onscroll</code>. </p>
  
  <p><strong>For <code>body</code>:</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;body onscroll="myFunction()"&gt;
  </code></pre>
  
  <p>The above one works but I'm not happy with this implementation while using blazor.</p>
  
  <p>Please assist on how to implement this purely with C#.</p>