From 1995c515918640041442c6fa377e2a0e108feacb Mon Sep 17 00:00:00 2001 From: Eduardo Gomez Date: Tue, 29 Oct 2019 10:20:52 +0100 Subject: [PATCH] Load smaller pictures to make blogs faster --- index.hbs | 4 ++-- package.json | 2 +- page-authors.hbs | 2 +- partials/header.hbs | 2 +- partials/loop.hbs | 4 ++-- src/js/app.js | 6 +++++- src/sass/common/_global.scss | 4 ++-- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/index.hbs b/index.hbs index 28a5fd46e..9d8df93f6 100644 --- a/index.hbs +++ b/index.hbs @@ -40,13 +40,13 @@ into the {body} of the default.hbs template --}} {{/if}}
{{#if feature_image}} -
+
{{/if}}
{{#if feature_image}} -
+
{{else}}
{{/if}} diff --git a/partials/loop.hbs b/partials/loop.hbs index c83da5298..8cdeb79ec 100644 --- a/partials/loop.hbs +++ b/partials/loop.hbs @@ -6,7 +6,7 @@ {{/is}} {{#if feature_image}}
-
+
{{else}}
@@ -14,7 +14,7 @@ {{#if primary_author.profile_image}} -
+
{{else}}
{{/if}} diff --git a/src/js/app.js b/src/js/app.js index fc13f8883..51647eb76 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -205,7 +205,11 @@ $(document).ready(() => { $('[data-aos]').addClass('no-aos-animation') } - const observer = lozad() + const observer = lozad('.lozad', { + loaded: (el) => { + el.classList.add('loaded') + } + }) observer.observe() tippy('.js-tooltip') diff --git a/src/sass/common/_global.scss b/src/sass/common/_global.scss index 80e8912e5..875a1d5d8 100644 --- a/src/sass/common/_global.scss +++ b/src/sass/common/_global.scss @@ -59,8 +59,8 @@ fieldset { z-index: 5; } -div[data-loaded="true"], -img[data-loaded="true"] { +div.lozad.loaded, +img.lozad.loaded { opacity: 0; @include animation('fadeIn 0.5s forwards'); @include keyframes(fadeIn) {