title: Javascript - Can I make this table scroll to top?
body: <p>I have to make a self-scrolling table. I tried using this:
  <a href="https://codepen.io/salman31/pen/dYdGLa" rel="nofollow noreferrer">https://codepen.io/salman31/pen/dYdGLa</a></p>
  
  <pre><code>    var my_time;
  $(document).ready(function() {
    pageScroll();
    $("#contain").mouseover(function() {
      clearTimeout(my_time);
    }).mouseout(function() {
      pageScroll();
    });
  });
  
  function pageScroll() {  
      var objDiv = document.getElementById("contain");
    objDiv.scrollTop = objDiv.scrollTop + 1;  
    $('p:nth-of-type(1)').html('scrollTop : '+ objDiv.scrollTop);
    $('p:nth-of-type(2)').html('scrollHeight : ' + objDiv.scrollHeight);
    //if (objDiv.scrollTop == (objDiv.scrollHeight - 50)) {
      objDiv.scrollTop = 0;
    //}
    my_time = setTimeout('pageScroll()', 25);
  }
  </code></pre>
  
  <p>And it works, but it doesn't automatically scroll back to top when it hits the "bottom". What do I need to change?</p>
  
  <p>Thank you!</p>