Replaced the blank loading image with HTML trick.
This commit is contained in:
parent
ef3860004e
commit
75e462a9e9
2 changed files with 2 additions and 6 deletions
|
@ -67,13 +67,9 @@ layout: default
|
|||
{% if page.image %}
|
||||
<img src="{{ page.image }}">
|
||||
{% endif %}
|
||||
<!-- Add lozad class into image tags. see: <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
||||
<!-- Using lozad. See: <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
||||
{% if content contains '<img src=' %}
|
||||
{% capture loading %}
|
||||
{{ "/assets/img/commons/loading.png" | relative_url }}
|
||||
{% endcapture %}
|
||||
{% assign replacement = '<img src=' | append: loading | append: ' data-src=' %}
|
||||
{{ content | replace: '<img src=', replacement }}
|
||||
{{ content | replace: '<img src=', '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src=' }}
|
||||
{% else %}
|
||||
{{ content }}
|
||||
{% endif %}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 99 B |
Loading…
Reference in a new issue