Get started with jquery-infinitescroll CDN

(GPL-3.0 OR Commercial License) licensed

JQuery Infinite Scroll: plugin for loading content without page reloads as user scrolls down.

Tags:
  • jquery
  • scroll
  • infinite
  • masonry
  • plugin
  • ui
  • DOM
  • browser

Stable version

Copied!

How to start using jquery-infinitescroll CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with jquery-infinitescroll CDN - cdnhub.io</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js">
  <link rel="stylesheet" href="https://cdn.cdnhub.io/jquery-infinitescroll/4.0.1/infinite-scroll.min.css">
  <script src="https://cdn.cdnhub.io/jquery-infinitescroll/4.0.1/infinite-scroll.pkgd.min.js"></script>
  <style>
    #content { height: 300px; overflow-y: auto; }
  </style>
</head>
<body>
  <div id="content">
    <!-- Your existing content here -->
  </div>

  <script>
    $(function() {
      $('#content').infinitescroll({
        nextSelector: '.next', // Change this to your next page link selector
        itemSelector: '.item', // Change this to your item selector
        loading: {
          finishedMsg: 'No more pages to load.'
        },
        data: {
          url: function(pageNumber, type) {
            return 'your-api-endpoint.com?page=' + pageNumber;
          }
        }
      }, function(newElements, data, pageNumber, next) {
        // Your custom callback function here
      });
    });
  </script>
</body>
</html>
Copied!
Copied!

All versions