Add friend app and fix avatar size

This commit is contained in:
yflory
2017-07-06 18:00:03 +02:00
parent af31771e3a
commit a5e8f6ae81
13 changed files with 234 additions and 22 deletions

View File

@@ -1307,27 +1307,32 @@ define([
}
var $image = $img.find('img');
var onLoad = function () {
var w = $image.width();
var h = $image.height();
if (w>h) {
$image.css('max-height', '100%');
var img = new Image();
img.src = $image.attr('src');
img.onload = function () {
var w = img.width;
var h = img.height;
console.log(w,h);
if (w>h) {
$image.css('max-height', '100%');
$img.css('flex-direction', 'column');
if (cb) { cb($img); }
return;
}
$image.css('max-width', '100%');
$img.css('flex-direction', 'row');
if (cb) { cb($img); }
return;
}
$image.css('max-width', '100%');
$img.css('flex-direction', 'column');
if (cb) { cb($img); }
};
};
if ($image[0].complete) { onLoad(); }
$image.on('load', onLoad);
}
});
observer.observe($img[0], {
attributes: false,
childList: true,
characterData: false
});
});
observer.observe($img[0], {
attributes: false,
childList: true,
characterData: false
});
});
}