Advertisement
afsarwebdev

JS-Loadmore images or content

Oct 22nd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. //Js Loadmore content or images
  2. //All divs are display none
  3. .single-gallery-col {
  4. display: none;
  5. }
  6. //JS
  7. // Load more gallery images
  8. $(function () {
  9. var TotalElement = $(".single-gallery-col").length;
  10. var currentElement = 9;
  11. $(".single-gallery-col").slice(0, 9).show();
  12.  
  13. $("#loadMore").on('click', function (e) {
  14. e.preventDefault();
  15. $(".single-gallery-col:hidden").slice(0, 3).fadeIn('600');
  16. currentElement=currentElement+3;
  17. if (TotalElement <= currentElement) {
  18. $("#loadMore").css({"display":"none"});
  19. }
  20. });
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement