var lightyear = function(){ /** * 页面loading */ var pageloader = function($mode) { var $loadingel = jquery('#lyear-loading'); $mode = $mode || 'show'; if ($mode === 'show') { if ($loadingel.length) { $loadingel.fadein(250); } else { jquery('body').prepend('
loading...
'); } } else if ($mode === 'hide') { if ($loadingel.length) { $loadingel.fadeout(250); } } return false; }; /** * 页面小提示 * @param $msg 提示信息 * @param $type 提示类型:'info', 'success', 'warning', 'danger' * @param $icon 图标,例如:'fa fa-user' 或 'glyphicon glyphicon-warning-sign' * @param $from 'top' 或 'bottom' * @param $align 'left', 'right', 'center' * @author caiweiming <314013107@qq.com> */ var tips = function ($msg, $type, $icon, $from, $align) { $type = $type || 'info'; $from = $from || 'top'; $align = $align || 'center'; $enter = $type == 'danger' ? 'animated shake' : 'animated fadeinup'; jquery.notify({ icon: $icon, message: $msg }, { element: 'body', type: $type, allow_dismiss: true, newest_on_top: true, showprogressbar: false, placement: { from: $from, align: $align }, offset: 20, spacing: 10, z_index: 10800, delay: 3000, timer: 2000, animate: { enter: $enter, exit: 'animated fadeoutdown' } }); }; return { // 页面小提示 notify : function ($msg, $type, $icon, $from, $align) { tips($msg, $type, $icon, $from, $align); }, // 页面加载动画 loading : function ($mode) { pageloader($mode); } }; }();