-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoastFull_demo.html
39 lines (39 loc) · 1.38 KB
/
toastFull_demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style type="text/css">
html,body{
height: 100%;
}
</style>
</head>
<body>
<p>配置项有:</p>
<p>textColor:字体颜色(默认#fff)</p>
<p>timer:显示时间(调用alert方法时生效,默认2000)</p>
<button id="demo1" type="button">普通alert</button>
<button id="demo2" type="button">模拟ajax</button>
<script src="toastFull.js"></script>
<script type="text/javascript">
var toast1 = new toastFull();
// 若想在一页内多次显示toast,无需多次实例化对象,但规定不能在前一个toast完全消失之前再次生成toast
document.getElementById('demo1').addEventListener('click',function(){
toast1.alert('恭喜你中奖了');
});
document.getElementById('demo2').addEventListener('click',function(){
toast1.loadStart('正在操作...');
setTimeout(function(){
toast1.loadFinishSuccess('加载成功');
// toast1.loadFinishError('加载失败');
},2000);
});
</script>
</body>
</html>