title: How to create vertically scrolling divs in jquery?
body: <p>I'm creating vertically auto scrolling divs using jquery with animation... I have finished creating it but the only problem is when I scroll down the window to the middle of list div where divs are scrolling, it pushes the window up to the scrolling list div. I don't know what the problem is. However when I try to give the list div width in pixels, it is not pushing up... </p>
  
  <p>Try to scroll down to the middle of the scrolling list div. You will understand what the problem is. Thanks...</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>setInterval(function(){
    $('#list').stop().animate({scrollTop:40}, 400, 'swing', function(){
      $(this).scrollTop(0).find('div:last').after($('div:first', this));
    });
  }, 1000);</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>* {
    box-sizing: border-box;
  }
  
  body {
    height: 1000px;
  }
  
  #list {
    overflow: hidden;
    width: 100%;
    height: 250px;
    background: red;
    padding: 10px;
    margin-top: 100px;
  }
  
  #list div {
    display: block;
    height: 30px;
    padding: 10px 10px;
    margin-bottom: 10px;
    background: yellow;
  }
  
  .item:last-child {
    margin-bottom: 0px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;div id="list"&gt;
    &lt;div&gt;Item 1&lt;/div&gt;
    &lt;div&gt;Item 2&lt;/div&gt;
    &lt;div&gt;Item 3&lt;/div&gt;
    &lt;div&gt;Item 4&lt;/div&gt;
    &lt;div&gt;Item 5&lt;/div&gt;
    &lt;div&gt;Item 6&lt;/div&gt;
    &lt;div&gt;Item 7&lt;/div&gt;
    &lt;div&gt;Item 8&lt;/div&gt;
    &lt;div&gt;Item 9&lt;/div&gt;
    &lt;div&gt;Item 10&lt;/div&gt;   
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>