index.js
801 Bytes
/**
* 个人中心首页
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/12
*/
var $ = require('jquery');
var $userAvatar = $('.user-avatar'),
$listItem = $('.list-item');
var myImage = new Image(),
avatar;
require('../product/recommend-for-you.js');
require('../product/suspend-cart.js');
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
$('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', function() {
$listItem.removeClass('highlight');
$(this).addClass('highlight');
}).on('touchend touchcancel', '.list-item, .type-item, .order-title', function() {
$(this).removeClass('highlight');
});