Created
January 7, 2022 19:25
-
-
Save manuelcanga/64003e143c72621963f4678921ba6fc8 to your computer and use it in GitHub Desktop.
Lazy load de imágenes (con soporte responsive)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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