-
-
Save musebe/7b728ae41b1851f9f1bf655bcbb2dc1c to your computer and use it in GitHub Desktop.
Load images after the whole page has loaded by just adding the class .async-img
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
// Default image data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mO8dPv2fwAImAOJMh4kwgAAAABJRU5ErkJggg== | |
function load_images(){ | |
var images = document.querySelectorAll(".async-img"); | |
for(var id=0; id<images.length; id++){ | |
var image = images[id]; | |
var img_url = image.getAttribute('url'); | |
image.src = img_url; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment