Technical SEO Website Audit

Lazy loader via CDN Register & Enqueue

  • June 4, 2018
  • Clients
  • 0 Comments
  • melissaSpiegel

Lazy is a fast, feature-rich, extensible and lightweight delayed content loading plugin for jQuery & Zepto. It’s designed to speed up page loading times and decrease traffic to your customers and users by only loading the content in view.

This plugin is made by Daniel ‘Eisbehr‘ Kern and is 100% FREE under MIT and / or GPL-2.0 license.


wp_register_script( 'lazy-load', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.min.js', 'jquery', null, true );
wp_enqueue_script('lazy-load');

wp_register_script( ‘lazy-load-plugin’, ‘https://cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.plugins.min.js’, ‘jquery’, null, true );
wp_enqueue_script(‘lazy-load’);

 

Basic Usage of lazy Loader

javascript

$(function() {
$('.lazy').Lazy();
});

HTML for lazy Loader

  <!-- load images the lazy way -->
    <img class="lazy" data-src="path/to/image.jpg" />

    <!-- load background images of other element types -->
    <div class="lazy" data-src="path/to/image.jpg"></div>

 

melissaSpiegel