Skip to content

Commit

Permalink
Galleria: Load first image earlier
Browse files Browse the repository at this point in the history
Galleria triggers loading of the main gallery iamge via javascript
which has two problems. It only triggers the load when javascript
has been processed and loads it at the same time as the second and
third image which means it's competing with background images for
bandwidth. We know that the first image will always be seen, so
trigger a load in the document rather than waiting for js to do it.
  • Loading branch information
edwinsteele committed Mar 4, 2018
1 parent 55399b2 commit d81476f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sigal/themes/galleria/templates/index.html
Expand Up @@ -12,6 +12,15 @@
<link rel="stylesheet" href="{{ theme.url }}/css/normalize.css">
<link rel="stylesheet" href="{{ theme.url }}/themes/classic/galleria.classic.css">
<link rel="stylesheet" href="{{ theme.url }}/css/style.css">
{# We will always want to show the first image when we're on an album page #}
{# Start loading now for faster document complete instead of waiting for js to load it #}
{% if album.medias %}
<style>
body::after{
position:absolute; width:0; height:0; overflow:hidden; z-index:-1;
content:url({{ album.medias[0].filename }});
}</style>
{% endif %}

{% if settings.show_map and album.show_map %}
<link rel="stylesheet" href="{{ theme.url }}/leaflet/leaflet.css" />
Expand Down

0 comments on commit d81476f

Please sign in to comment.