Answer the question
In order to leave comments, you need to log in
How to use fancybox and lazy load together?
Question of such a plan
I use fancibox
https://fancyapps.com/fancybox/3/docs/#ajax
and lazy loading
jquery.eisbehr.de/lazy/#installation
So it turned out that this and that should be on the same block
<a data-fancybox data-type="ajax" data-src="products/{$product->url}?preview" class="item__img lazyload" {if $product->image} style="background-image: url();"{/if}></a>
data-src="products/{$product->url}?preview"
Answer the question
In order to leave comments, you need to log in
<a data-fancybox data-type="ajax" href="products/{$product->url}?preview" class="item__img lazy" data-src="{$product->image->filename|resize:1200:1200}" {if $product->image} style="background-image: url({$product->image->filename|resize:1200:1200});"{/if}></a>
.attr(_srcset, element.attr(srcsetAttribute))
swears at this line// do it as single 'attr' calls, to be sure 'src' is set after 'srcset'
var imageSrc = (_isRetinaDisplay && elementRetina ? elementRetina : element.attr(srcAttribute)) || '';
imageObj.attr(_sizes, element.attr(sizesAttribute))
.attr(_srcset, element.attr(srcsetAttribute))
.attr(_src, imageSrc ? imageBase + imageSrc : null);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question