check-top.js 719 Bytes
/**
 * 星潮教室-top100
 * @author: wsl<shuiling.wang@yoho.cn>
 * @date: 2016/4/12
 */

var $ = require('jquery');

$('body').addClass('star-class-body');

function setAvatar($userAvatar) {
    var myImage = new Image(),
        avatar;

    // 部分老用户没有头像,显示默认头像
    avatar = $userAvatar.data('avatar');
    myImage.src = avatar;
    myImage.onload = function() {
        $userAvatar.css('background-image', 'url(' + avatar + ')');
    };
}

if ($('.ranking-area li').length > 0) {
    $.each($('.ranking-area li'), function(key, item) {
        setAvatar($(item).find('.rank-avatar'));
    });
}

if ($('.user-avatar').attr('data-avatar') !== '') {
    setAvatar($('.user-avatar'));
}