Skip to content

Instantly share code, notes, and snippets.

@manuelcanga
Created January 7, 2022 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manuelcanga/64003e143c72621963f4678921ba6fc8 to your computer and use it in GitHub Desktop.
Save manuelcanga/64003e143c72621963f4678921ba6fc8 to your computer and use it in GitHub Desktop.
Lazy load de imágenes (con soporte responsive)
/**
Alternativa de menos de 1kb: https://apoorv.pro/lozad.js/demo/
*/
document.addEventListener('DOMContentLoaded', function () {
var bLazy = new Blazy({
src: 'data-src',
selector: '*[data-src]',
offset: 500,
breakpoints: [
{width: 1024, src: 'data-src'},
{width: 1920, src: 'data-desktop'}
]
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment