效果图
hui.loading(msg)
功能:展示一个居中的Loading效果,使用hui.closeLoading()函数可以关闭它。
参数:
1、msg 加载提示文本
2、是否关闭
返回:无
huibase.closeLoading()
功能:关闭loading动画
参数:无
返回:无
示例代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HUI - Loading</title>
<link rel="stylesheet" type="text/css" href="../css/hui.css" />
</head>
<body>
<header class="hui-header">
<div id="hui-back"></div>
<h1>HUI - Loading</h1>
</header>
<div class="hui-wrap">
<div class="hui-common-title" style="margin-top:15px;">
<div class="hui-common-title-line"></div>
<div class="hui-common-title-txt">Loading 演示</div>
<div class="hui-common-title-line"></div>
</div>
<div style="padding:28px;">
<button type="button" class="hui-button hui-button-large" id="btn1">普通 Loading</button>
<button type="button" class="hui-button hui-button-large" id="btn2" style="margin-top:20px;">H5+ 原生 Loading</button>
</div>
</div>
<script src="../js/hui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
hui('#btn1').click(function(){
hui.loading('数据加载中');
setTimeout(function(){hui.loading(false, true);}, 2000);
});
hui('#btn2').click(function(){
if(!window.plus){
hui.alert('只能在h5+环境下运行!');
return false;
}
hui.h5Loading(false, '加载中...',{round:2, padding:'20px', textalign:'right'});
setTimeout(function(){hui.h5Loading(true);}, 2000);
});
</script>
</body>
</html>