You are here

function image_lazy_loader_preprocess_page in Image Lazy Loader 7

File

./image_lazy_loader.module, line 216
adds a formatter for images that makes them 'lazy load' using Javascript Image Asynchronous Loading

Code

function image_lazy_loader_preprocess_page(&$vars) {

  // Add animate.css library if checked in /admin/config/media/ill-config
  if (variable_get('image_lazy_loader_animate_library', 0)) {
    drupal_add_css(drupal_get_path('module', 'image_lazy_loader') . '/animate-css/animate.min.css');
  }

  // Add Lozad.js library
  drupal_add_js(drupal_get_path('module', 'image_lazy_loader') . '/lozad/dist/lozad.js');

  // Init Lozad.js
  drupal_add_js(drupal_get_path('module', 'image_lazy_loader') . '/image_lazy_loader.js', array(
    'type' => 'file',
    'scope' => 'footer',
    'weight' => 5,
  ));
}