title: jQuery how to use lazy load to load more content on scroll
body: <p>Hi I am trying to use lazy load in my page. In first look it will display first 3 div child . Then after scroll it will increase according to size.
  I have tried some click on action to load more . but I want to add functionality on scroll. Below my code</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).ready(function () {
      size_li = $("#myList li").size();
      x=3;
      $('#myList li:lt('+x+')').show();
      $('#loadMore').click(function () {
          x= (x+5 &lt;= size_li) ? x+5 : size_li;
          $('#myList li:lt('+x+')').show();
      });
      $('#showLess').click(function () {
          x=(x-5&lt;0) ? 3 : x-5;
          $('#myList li').not(':lt('+x+')').hide();
      });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#myList li{ display:none;
  }
  #loadMore {
      color:green;
      cursor:pointer;
  }
  #loadMore:hover {
      color:black;
  }
  #showLess {
      color:red;
      cursor:pointer;
  }
  #showLess:hover {
      color:black;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;ul id="myList"&gt;
      &lt;li&gt;One&lt;/li&gt;
      &lt;li&gt;Two&lt;/li&gt;
      &lt;li&gt;Three&lt;/li&gt;
      &lt;li&gt;Four&lt;/li&gt;
      &lt;li&gt;Five&lt;/li&gt;
      &lt;li&gt;Six&lt;/li&gt;
      &lt;li&gt;Seven&lt;/li&gt;
      &lt;li&gt;Eight&lt;/li&gt;
      &lt;li&gt;Nine&lt;/li&gt;
      &lt;li&gt;Ten&lt;/li&gt;
      &lt;li&gt;Eleven&lt;/li&gt;
      &lt;li&gt;Twelve&lt;/li&gt;
      &lt;li&gt;Thirteen&lt;/li&gt;
      &lt;li&gt;Fourteen&lt;/li&gt;
      &lt;li&gt;Fifteen&lt;/li&gt;
      &lt;li&gt;Sixteen&lt;/li&gt;
      &lt;li&gt;Seventeen&lt;/li&gt;
      &lt;li&gt;Eighteen&lt;/li&gt;
      &lt;li&gt;Nineteen&lt;/li&gt;
      &lt;li&gt;Twenty one&lt;/li&gt;
      &lt;li&gt;Twenty two&lt;/li&gt;
      &lt;li&gt;Twenty three&lt;/li&gt;
      &lt;li&gt;Twenty four&lt;/li&gt;
      &lt;li&gt;Twenty five&lt;/li&gt;
  &lt;/ul&gt;
  &lt;div id="loadMore"&gt;Load more&lt;/div&gt;
  &lt;div id="showLess"&gt;Show less&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>