sweetalert.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>H+ 后台主题UI框架 - Sweet alert</title>
  7. <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
  8. <meta name="description" content="H+是一个完全响应式,基于Bootstrap3最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术">
  9. <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
  10. <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
  11. <!-- Sweet Alert -->
  12. <link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
  13. <link href="css/animate.css" rel="stylesheet">
  14. <link href="css/style.css?v=4.1.0" rel="stylesheet">
  15. </head>
  16. <body class="gray-bg">
  17. <div class="wrapper wrapper-content animated fadeInRight">
  18. <div class="row">
  19. <div class="col-sm-12">
  20. <div class="ibox ">
  21. <div class="ibox-title">
  22. <h5>Sweet Alert</h5>
  23. </div>
  24. <div class="ibox-content">
  25. <strong>可以替换JavaScript中alert的插件</strong>
  26. <p>
  27. Sweet Alert 是一个替代传统的 JavaScript Alert 的漂亮提示效果。SweetAlert 自动居中对齐在页面中央,不管您使用的是台式电脑,手机或平板电脑看起来效果都很棒。另外提供了丰富的自定义配置选择,可以灵活控制。项目主页:
  28. <a href="http://t4t5.github.io/sweetalert/" target="_blank">http://t4t5.github.io/sweetalert/</a>
  29. </p>
  30. <div class="row text-center">
  31. <div class="col-sm-6 h-100 p-lg">
  32. <p>基本消息</p>
  33. <button class="btn btn-primary btn-sm demo1">打开示例</button>
  34. </div>
  35. <div class="col-sm-6 h-100 p-lg">
  36. <p>成功提示 </p>
  37. <button class="btn btn-success btn-sm demo2">打开示例</button>
  38. </div>
  39. <div class="col-sm-6 h-100 p-lg">
  40. <p>警告信息</p>
  41. <button class="btn btn-warning btn-sm demo3">打开示例</button>
  42. </div>
  43. <div class="col-sm-6 h-100 p-lg">
  44. <p>通过传参可以自定义取消按钮 </p>
  45. <button class="btn btn-danger btn-sm demo4">打开示例</button>
  46. </div>
  47. </div>
  48. <div class="m-t-md">
  49. <p>
  50. 您可以在js中很简单的实用SweetAlert,如添加一个警告框:
  51. </p>
  52. <pre>
  53. $('.demo3').click(function () {
  54. swal({
  55. title: "您确定要删除这条信息吗",
  56. text: "删除后将无法恢复,请谨慎操作!",
  57. type: "warning",
  58. showCancelButton: true,
  59. confirmButtonColor: "#DD6B55",
  60. confirmButtonText: "删除",
  61. closeOnConfirm: false
  62. }, function () {
  63. swal("删除成功!", "您已经永久删除了这条信息。", "success");
  64. });
  65. });</pre>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. <!-- 全局js -->
  73. <script src="js/jquery.min.js?v=2.1.4"></script>
  74. <script src="js/bootstrap.min.js?v=3.3.7"></script>
  75. <!-- 自定义js -->
  76. <script src="js/content.js?v=1.0.0"></script>
  77. <!-- Sweet alert -->
  78. <script src="js/plugins/sweetalert/sweetalert.min.js"></script>
  79. <script>
  80. $(document).ready(function () {
  81. $('.demo1').click(function () {
  82. swal({
  83. title: "欢迎使用SweetAlert",
  84. text: "Sweet Alert 是一个替代传统的 JavaScript Alert 的漂亮提示效果。"
  85. });
  86. });
  87. $('.demo2').click(function () {
  88. swal({
  89. title: "太帅了",
  90. text: "小手一抖就打开了一个框",
  91. type: "success"
  92. });
  93. });
  94. $('.demo3').click(function () {
  95. swal({
  96. title: "您确定要删除这条信息吗",
  97. text: "删除后将无法恢复,请谨慎操作!",
  98. type: "warning",
  99. showCancelButton: true,
  100. confirmButtonColor: "#DD6B55",
  101. confirmButtonText: "删除",
  102. closeOnConfirm: false
  103. }, function () {
  104. swal("删除成功!", "您已经永久删除了这条信息。", "success");
  105. });
  106. });
  107. $('.demo4').click(function () {
  108. swal({
  109. title: "您确定要删除这条信息吗",
  110. text: "删除后将无法恢复,请谨慎操作!",
  111. type: "warning",
  112. showCancelButton: true,
  113. confirmButtonColor: "#DD6B55",
  114. confirmButtonText: "是的,我要删除!",
  115. cancelButtonText: "让我再考虑一下…",
  116. closeOnConfirm: false,
  117. closeOnCancel: false
  118. },
  119. function (isConfirm) {
  120. if (isConfirm) {
  121. swal("删除成功!", "您已经永久删除了这条信息。", "success");
  122. } else {
  123. swal("已取消", "您取消了删除操作!", "error");
  124. }
  125. });
  126. });
  127. });
  128. </script>
  129. <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
  130. <!--统计代码,可删除-->
  131. </body>
  132. </html>