It's worth noting that your lazy load library does appear to support custom class names, so that could be something for you to explore:
High performance and SEO friendly lazy loader for images (responsive and normal), iframes and more, that detects any visibility changes triggered through user interaction, CSS or JavaScript without...
github.com
But aside from that, as I mentioned before, the pattern we're using here isn't exactly uncommon. There are a lot of templater functions which return HTML and that's not exactly something we necessarily want to convert entirely to rendered templates in a lot of the simpler cases (such as this one) or cases where we don't necessarily want the HTML structure to be modified.
However, coming in XF 2.1 is something which will allow you to use class extensions to change the templater function, which should help.
It's something we've been considering for a while and added earlier today, so you will first be able to do it in the next XFMG 2.1 release.
You will just need to extend the
XFMG\Template\TemplaterSetup
class and modify the return value of the
fnThumbnail
method in there.
As a side note, I'm not sure if your lazy load library is intelligent enough to find and work on a
child image, but if it does then there is a solution you could implement straight away.
What I mean is, if the HTML had this structure:
HTML:
<div class="xfmgThumbnail lazyload">
<img class='xfmgThumbnail-image' src='some/url' alt='some title' />
<span class='xfmgThumbnail-icon'></span>
</div>
Would it pick up the
lazyload
class on the
div
element, and then find the child
img
element and lazy load that?
If so, then the XFMG thumbnail templater function does support passing in a custom class name, e.g:
Code:
{{ xfmg_thumbnail($item, 'xfmgThumbnail--smallest') }}
Would change to:
Code:
{{ xfmg_thumbnail($item, 'xfmgThumbnail--smallest lazyload') }}
This:
Code:
{{ xfmg_thumbnail($album) }}
Would change to:
Code:
{{ xfmg_thumbnail($album, 'lazyload') }}
And so on.
Hopefully that helps, but not sure we'll be making any changes here in the near future. I'll leave your suggestion thread open though.