<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<title>layer移动端弹窗</title>
<style>
button{
width:6rem;
height:3rem;
line-height: 3rem;
}
</style>
<!--
http://layer.layui.com/mobile/
layer mobile-v2.0
-->
</head>
<body>
<button id="loading">loading</button>
<button id="toast">toast</button>
<script src="layer.js"></script>
<script>
var loadingdom = document.getElementById("loading");
loadingdom.onclick = function(){
//loading带文字
layer.open({
type: 2
,content: '加载中'
/* ,time:"3"*/
});
};
/*layer.open({
type: 2
,content: '加载中'
});*/
var toastdom = document.getElementById("toast");
toastdom.onclick = function(){
//提示
layer.open({
content: 'hello layer'
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
}
</script>
</body>
</html>
来源:https://www.cnblogs.com/qixianchuan/p/11162888.html