javascript - Load more and combining pages -


at moment have 3 pages , button re-directing next page. wondering if there way how once click on load more or hit bottom of page load next page loaded products? forgot explain on each page have 3 items. again there way how can add button automatically load next 3 <li> elements until end reached? here code:

 <ul>     <li class="item">     <div class="item__media">     <div class="item__image"><a class="product-image item__link" href="http://www.google.com" title="google"><img alt="bmw" src="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" /> </a></div>      <div class="item__detail"><a class="item__link" href="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" title="bmw motor bike">     <p class="product-name item__name">bmw motorbike</p>     </a>       </div>         </div>         </li>         <li class="item">     <div class="item__media">     <div class="item__image"><a class="product-image item__link" href="http://www.google.com" title="google"><img alt="bmw" src="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" /> </a></div>      <div class="item__detail"><a class="item__link" href="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" title="bmw motor bike">     <p class="product-name item__name">bmw motorbike</p>     </a>       </div>         </div>         </li>         <li class="item">     <div class="item__media">     <div class="item__image"><a class="product-image item__link" href="http://www.google.com" title="google"><img alt="bmw" src="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" /> </a></div>      <div class="item__detail"><a class="item__link" href="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" title="bmw motor bike">     <p class="product-name item__name">bmw motorbike</p>     </a>       </div>         </div>         </li>         <li class="item">     <div class="item__media">     <div class="item__image"><a class="product-image item__link" href="http://www.google.com" title="google"><img alt="bmw" src="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" /> </a></div>      <div class="item__detail"><a class="item__link" href="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" title="bmw motor bike">     <p class="product-name item__name">bmw motorbike</p>     </a>       </div>         </div>         </li>         <li class="item">     <div class="item__media">     <div class="item__image"><a class="product-image item__link" href="http://www.google.com" title="google"><img alt="bmw" src="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" /> </a></div>      <div class="item__detail"><a class="item__link" href="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" title="bmw motor bike">     <p class="product-name item__name">bmw motorbike</p>     </a>       </div>         </div>         </li>         <li class="item">     <div class="item__media">     <div class="item__image"><a class="product-image item__link" href="http://www.google.com" title="google"><img alt="bmw" src="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" /> </a></div>      <div class="item__detail"><a class="item__link" href="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" title="bmw motor bike">     <p class="product-name item__name">bmw motorbike</p>     </a>       </div>         </div>         </li>         <li class="item">     <div class="item__media">     <div class="item__image"><a class="product-image item__link" href="http://www.google.com" title="google"><img alt="bmw" src="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" /> </a></div>      <div class="item__detail"><a class="item__link" href="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" title="bmw motor bike">     <p class="product-name item__name">bmw motorbike</p>     </a>       </div>         </div>         </li>         <li class="item">     <div class="item__media">     <div class="item__image"><a class="product-image item__link" href="http://www.google.com" title="google"><img alt="bmw" src="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" /> </a></div>      <div class="item__detail"><a class="item__link" href="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" title="bmw motor bike">     <p class="product-name item__name">bmw motorbike</p>     </a>       </div>         </div>         </li>         <li class="item">     <div class="item__media">     <div class="item__image"><a class="product-image item__link" href="http://www.google.com" title="google"><img alt="bmw" src="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" /> </a></div>      <div class="item__detail"><a class="item__link" href="http://upload.wikimedia.org/wikipedia/commons/d/d5/bmw_s1000rr_race.jpg" title="bmw motor bike">     <p class="product-name item__name">bmw motorbike</p>     </a>       </div>         </div>         </li> </ul> 

this other method can proceed while clicking on load next page option

$(document).ready(function(){   $("span.page1").click(function(){      $("li.container2").load("page2.html");   });   $("span.page2").click(function(){      $("li.container3").load("page3.html");   }); }); <ul>   <li class="container1">     continer content goes here     <span class="page1">click here load page 2</span>   </li>   <li class="container2">   </li>   <li class="container3">   </li> </ul> 

i hope simple , enjoy dont forget include jquery library before


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -