Last active
February 4, 2018 11:34
-
-
Save Billcountry/1a17d28853fe6fb600299747a7de64c5 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