Created
June 5, 2014 12:08
-
-
Save kuc-arc-f/121662900eeb08c14bc2 to your computer and use it in GitHub Desktop.
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
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', imageUrl); | |
xhr.responseType = 'blob'; | |
xhr.onload = function() { | |
var img = document.createElement('img'); | |
img.setAttribute('data-src', imageUrl); | |
img.setAttribute('id', s_id); | |
img.className = 'icon'; | |
var objURL = this._createObjectURL(xhr.response); | |
img.setAttribute('src', objURL); | |
element.appendChild(img); | |
return img; | |
}.bind(this); | |
xhr.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment