Skip to content

Commit

Permalink
example: use .img method instead of .url
Browse files Browse the repository at this point in the history
  • Loading branch information
retrofox committed Aug 31, 2013
1 parent 829f5cf commit a0d5855
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/index.js
Expand Up @@ -11,20 +11,21 @@ var Grt = require('gravatar');
*/

var body = o('body');
var img = o('.image-placeholder img');
var img_ph = o('.image-placeholder');
var email = o('input[name=email]');
var size = o('input[name=size]');
var img;

function printAvatar(email, s){
img.removeAttr('src');
if (img) img.remove();
body.addClass('loading');

var url = Grt.url(email, { s: s || 100 });
img
.attr('src', url)
img = o(Grt.img(email, { s: s || 100 }))
.appendTo(img_ph)
.on('load', function(){
body.removeClass('loading');
});

}

// input keypress event
Expand Down

0 comments on commit a0d5855

Please sign in to comment.