Authored by ccbikai

修改头像加载失败检测方法

... ... @@ -4,9 +4,11 @@
* @date: 2015/11/12
*/
var $ = require('jquery');
var $userAvatar = $('.user-avatar');
var myImage = new Image();
require('../product/recommend-for-you.js');
$('.user-avatar').on('error', function() {
$(this).attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
});
\ No newline at end of file
myImage.src = $userAvatar.attr('src');
myImage.onerror = function() {
$userAvatar.attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
};
... ...
... ... @@ -4,7 +4,10 @@
* @date: 2015/11/19
*/
var $ = require('jquery');
var $userAvatar = $('.user-avatar');
var myImage = new Image();
$('.user-avatar').on('error', function() {
$(this).attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
});
\ No newline at end of file
myImage.src = $userAvatar.attr('src');
myImage.onerror = function() {
$userAvatar.attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
};
... ...