Skip to content

Instantly share code, notes, and snippets.

View jess's full-sized avatar

Jess Brown jess

View GitHub Profile
## js at bottom of layout
# source https://www.npmjs.com/package/vanilla-lazyload
<script>
(function(w, d){
var b = d.getElementsByTagName('body')[0];
var s = d.createElement("script");
var v = !("IntersectionObserver" in w) ? "8.17.0" : "10.19.0";
s.async = true; // This includes the script as async. See the "recipes" section for more information about async loading of LazyLoad.
s.src = "https://cdn.jsdelivr.net/npm/vanilla-lazyload@" + v + "/dist/lazyload.min.js";
w.lazyLoadOptions = {/* Your options here */};