Skip to content

Instantly share code, notes, and snippets.

@toaotc
Forked from anonymous/jquery.src.js
Created August 16, 2011 09:23
Show Gist options
  • Save toaotc/1148723 to your computer and use it in GitHub Desktop.
Save toaotc/1148723 to your computer and use it in GitHub Desktop.
jQuery src loading plugin
(function($) {
$.fn.src = function(uri, callback) {
return this.each(function() {
var $this = $(this);
$this.attr('src', 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==');
$this.one('load', callback);
$this.attr('src', uri);
})
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment