loading.js 591 Bytes
/**
 * Loading mask
 * @author: xuqi<qi.xu@yoho.cn>
 * @date: 2015/10/29
 */

var $ = require('yoho.zepto');

var $page = $('.yoho-page');

var $loading;

//初始化
(function() {
    var html = '<div class="loading-mask hide"><div class="loading"></div></div>';

    $page.append(html);

    $loading = $page.children('.loading-mask');
}());

//显示loading
function showLoadingMask() {
    $loading.removeClass('hide');
}

//隐藏loading
function hideLoadingMask() {
    $loading.addClass('hide');
}

exports.showLoadingMask = showLoadingMask;
exports.hideLoadingMask = hideLoadingMask;