Easily apply lazyload to images with transitions on <picture> elements

Please note: This component requires the Sass file /assets/styles/sass/core/js/_lazyload.scss

This currently works with the latest version of FatStack (we'll work on a WordPress implementation soon). For a fade effect it requires a parent element.


Lazyload provides a simple way to speed up web pages by adding the bulk of image loading to JavaScript and only when the image is near the viewport. You just need some specific markup for your images to get it working.


<picture class="f-lazyload-image">
	<source srcset=";blur" data-f-src="" media="(min-width: 1220px)">
	<source srcset=";blur" data-f-src="" media="(min-width: 768px)">
	<img src=";blur" data-f-src="" class="f-width-1-1" alt="">


Background Image

The <picture> tag should really be used for big background images for sections of a webpage because it allows the same efficiency of loading a small image with the page and then replacing it with the full size image when the page nears the section and the image has loaded fully.


<section class="f-lazyload-background f-flex example" style="height: 500px">
	<picture class="f-lazyload-cover f-lazyload-image">
		<img src=";blur" data-f-src="" alt="">
	<div class="f-flex f-flex-middle f-flex-center f-flex-column example-text">
		<p>Some text</p>



Some text