diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2014-02-04 23:13:48 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2014-02-04 23:13:48 +0100 |
commit | d6d22f2c1f10cb19b3976a76d78c20349bb95f76 (patch) | |
tree | dde84436aa7684ae9f29de00308a1f4431148f60 /templates | |
parent | 2b57544d7fe37998dab6f54612d5dd10ff3efb8d (diff) |
Added lazy load to image page.jabless
Diffstat (limited to 'templates')
-rw-r--r-- | templates/images.tmpl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/templates/images.tmpl b/templates/images.tmpl index a54bef2..7de8bd3 100644 --- a/templates/images.tmpl +++ b/templates/images.tmpl @@ -2,12 +2,17 @@ #def header: images #extends templates.base #def head +<script type="text/javascript" src="${settings.virtual_root}s/jquery-2.1.0.min.js"></script> +<script type="text/javascript" src="${settings.virtual_root}s/jquery.lazyload.min.js"></script> <script type="text/javascript"> function thumb_onerror(img) { var no_thumb = '${settings.virtual_root}s/no-thumbnail.png'; if(img.src != no_thumb) img.src = no_thumb; } + \$(function() { + \$('img.lazy').lazyload(); + }); </script> #end def #def content @@ -15,7 +20,7 @@ #if len($files) <div class="image-list"> #for file in $files - <div class="image">$file.image_html</div> + <div class="image"><a href="${settings.virtual_root}f/${file.hash}${file.ext}" title="$file.filename"><img class="lazy" data-original="${settings.virtual_root}t/$file.hash" alt="$file.filename" onerror="thumb_onerror(this)" /><noscript><img src="${settings.virtual_root}t/$file.hash" alt="$file.filename" /></noscript></a></div> #end for </div> #else |