npm install sweetalert
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<link rel="stylesheet" href="css/sweetalert.css" />
</head>
<body>
<script src="js/sweetalert.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
swal('好友请求','hell~你好吗?','error');
</script>
</body>
</html>
螢幕快照 2015-08-30 下午11.16.46.png
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<link rel="stylesheet" href="css/sweetalert.css" />
</head>
<body>
<script src="js/sweetalert.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
swal({
title: '好友请求',
text: 'hello~你好吗?<i class="smile icon"></i>',
html: true,
imageUrl: 'images/qq.png',//图片
type: 'warning',//提示框类型
showConfirmButton: false,//按钮不显示
timer: 2000 //消失时间
})
</script>
</body>
</html>
螢幕快照 2015-08-30 下午11.18.46.png
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<link rel="stylesheet" href="css/sweetalert.css" />
</head>
<body>
<script src="js/sweetalert.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
swal({
title: '好友请求',
text: 'hello~你好吗?',
html: true,
imageUrl: 'images/qq.png',
confirmButtonText: '接收',
confirmButtonColor: '#6435c9',
closeOnConfirm: false,
showCancelButton: true,
cancelButtonText: '拒绝',
closeOnCancel: false
},function(isConfirm){
if(isConfirm){
swal('成功','您已经成为了hulk的好友','success');
}else{
swal('拒绝','您拒绝了hulk的好友请求','error');
}
})
</script>
</body>
</html>
螢幕快照 2015-08-30 下午11.27.36.png
<link rel="stylesheet" type="text/css" href="css/facebook.css"/>
<link rel="stylesheet" type="text/css" href="css/google.css"/>
<link rel="stylesheet" href="css/twitter.css" />