Skip to content

Instantly share code, notes, and snippets.

@dejanr
Last active December 14, 2015 04:18
Show Gist options
  • Save dejanr/5026913 to your computer and use it in GitHub Desktop.
Save dejanr/5026913 to your computer and use it in GitHub Desktop.
Hack for image load
// cached images don't fire load sometimes, so we reset src.
// this is DOM Node
if (this.complete || this.complete === undefined){
var src = this.src;
// webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
// data uri bypasses webkit log warning (thx doug jones)
this.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
this.src = src;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment