diff --git a/lib/tools/phantomas/custom_modules/modules/lazyLoadableYLT/lazyLoadableYLT.js b/lib/tools/phantomas/custom_modules/modules/lazyLoadableYLT/lazyLoadableYLT.js index c3cfc45..8e2f042 100644 --- a/lib/tools/phantomas/custom_modules/modules/lazyLoadableYLT/lazyLoadableYLT.js +++ b/lib/tools/phantomas/custom_modules/modules/lazyLoadableYLT/lazyLoadableYLT.js @@ -26,7 +26,9 @@ exports.module = function(phantomas) { path, processedImages = {}, src, - viewportHeight = window.innerHeight; + viewportHeight = window.innerHeight, + // Add an offset of 100px under the height of the screen + LAZYLOAD_OFFSET = 100; phantomas.log('lazyLoadableImages: %d image(s) found, assuming %dpx offset to be the fold', len, viewportHeight); @@ -64,7 +66,7 @@ exports.module = function(phantomas) { Object.keys(processedImages).forEach(function(src) { var img = processedImages[src]; - if (img.offset > viewportHeight) { + if (img.offset > viewportHeight + LAZYLOAD_OFFSET) { phantomas.log('lazyLoadableImages: <%s> image (%s) is below the fold (at %dpx)', src, img.path, img.offset); phantomas.incrMetric('lazyLoadableImagesBelowTheFold');