Get started with oclazyload CDN

MIT licensed

OCLazyLoad: library, defers, progressively loads AngularJS components for improved performance.

Tags:
  • lazy load
  • lazy-load
  • load on demand
  • module
  • angular
  • angularJS

Stable version

Copied!

How to start using oclazyload CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with oclazyload CDN - cdnhub.io</title>
  <link rel="stylesheet" href="styles.css">
  <script src="https://cdn.cdnhub.io/oclazyload/1.1.0/ocLazyLoad.min.js"></script>
  <script>
    document.addEventListener('DOMContentLoaded', function() {
      new OCLazyLoad().init();
    });
  </script>
</head>
<body>
  <header>
    <h1>OCListLoad Example</h1>
  </header>
  <main>
    <p>Click the button to load the image:</p>
    <button id="loadImage">Load Image</button>
    <img data-oc-lazy="true" src="image.jpg" alt="Lazy Loaded Image" class="lazy-image">
  </main>
  <script>
    const loadImageButton = document.getElementById('loadImage');
    loadImageButton.addEventListener('click', function() {
      new OCLazyLoad().handle('img.lazy-image').then(function() {
        console.log('Image loaded lazily!');
      });
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions