toastr_notifications.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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框架 - Toastr通知</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.6" rel="stylesheet">
  10. <link href="../css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
  11. <link href="../css/animate.min.css" rel="stylesheet">
  12. <link href="../css/style.min.css?v=4.1.0" rel="stylesheet">
  13. <link href="../css/plugins/toastr/toastr.min.css" rel="stylesheet">
  14. </head>
  15. <body class="gray-bg">
  16. <div class="row">
  17. <div class="col-lg-12">
  18. <div class="wrapper wrapper-content">
  19. <div class="row">
  20. <div class="col-lg-12">
  21. <div class="ibox float-e-margins">
  22. <div class="ibox-title">
  23. <h5>Toastr示例</h5>
  24. <div class="ibox-tools">
  25. <a class="collapse-link">
  26. <i class="fa fa-chevron-up"></i>
  27. </a>
  28. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  29. <i class="fa fa-wrench"></i>
  30. </a>
  31. <ul class="dropdown-menu dropdown-user">
  32. <li><a href="#">设置选项1</a>
  33. </li>
  34. <li><a href="#">设置选项2</a>
  35. </li>
  36. </ul>
  37. <a class="close-link">
  38. <i class="fa fa-times"></i>
  39. </a>
  40. </div>
  41. </div>
  42. <div class="ibox-content">
  43. <div class="row">
  44. <div class="col-md-4">
  45. <div class="form-group">
  46. <label for="title">标题</label>
  47. <input id="title" type="text" class="form-control" placeholder="请输入标题...">
  48. </div>
  49. <div class="form-group">
  50. <label for="message">消息</label>
  51. <textarea class="form-control" id="message" rows="3" placeholder="请输入消息..."></textarea>
  52. </div>
  53. <div class="checkbox">
  54. <label class="checkbox" for="closeButton">
  55. <input id="closeButton" type="checkbox" value="checked" class="input-mini" checked="">关闭按钮
  56. </label>
  57. </div>
  58. <div class="checkbox">
  59. <label class="checkbox" for="addBehaviorOnToastClick">
  60. <input id="addBehaviorOnToastClick" type="checkbox" value="checked" class="input-mini">添加Toast单击行为
  61. </label>
  62. </div>
  63. <div class="checkbox">
  64. <label class="checkbox" for="debugInfo">
  65. <input id="debugInfo" type="checkbox" value="checked" class="input-mini">Debug
  66. </label>
  67. </div>
  68. <div class="checkbox">
  69. <label class="checkbox" for="progressBar">
  70. <input id="progressBar" type="checkbox" value="checked" class="input-mini" checked="">进度条
  71. </label>
  72. </div>
  73. <div class="checkbox">
  74. <label class="checkbox" for="preventDuplicates">
  75. <input id="preventDuplicates" type="checkbox" value="checked" class="input-mini">防止重复
  76. </label>
  77. </div>
  78. </div>
  79. <div class="col-md-2">
  80. <div class="form-group" id="toastTypeGroup">
  81. <label>Toast类型</label>
  82. <div class="radio">
  83. <label>
  84. <input type="radio" name="toasts" value="success" checked="">成功
  85. </label>
  86. </div>
  87. <div class="radio">
  88. <label class="radio">
  89. <input type="radio" name="toasts" value="info">信息
  90. </label>
  91. </div>
  92. <div class="radio">
  93. <label class="radio">
  94. <input type="radio" name="toasts" value="warning">警告
  95. </label>
  96. </div>
  97. <div class="radio">
  98. <label class="radio">
  99. <input type="radio" name="toasts" value="error">错误
  100. </label>
  101. </div>
  102. </div>
  103. <div class="form-group" id="positionGroup">
  104. <label>Position</label>
  105. <div class="radio">
  106. <label>
  107. <input type="radio" name="positions" value="toast-top-right" checked="">右上
  108. </label>
  109. </div>
  110. <div class="radio">
  111. <label>
  112. <input type="radio" name="positions" value="toast-bottom-right">右下
  113. </label>
  114. </div>
  115. <div class="radio">
  116. <label>
  117. <input type="radio" name="positions" value="toast-bottom-left">左下
  118. </label>
  119. </div>
  120. <div class="radio">
  121. <label>
  122. <input type="radio" name="positions" value="toast-top-left">左上
  123. </label>
  124. </div>
  125. <div class="radio">
  126. <label>
  127. <input type="radio" name="positions" value="toast-top-full-width">顶部全宽
  128. </label>
  129. </div>
  130. <div class="radio">
  131. <label>
  132. <input type="radio" name="positions" value="toast-bottom-full-width">底部全宽
  133. </label>
  134. </div>
  135. <div class="radio">
  136. <label>
  137. <input type="radio" name="positions" value="toast-top-center">顶部居中
  138. </label>
  139. </div>
  140. <div class="radio">
  141. <label>
  142. <input type="radio" name="positions" value="toast-bottom-center">底部居中
  143. </label>
  144. </div>
  145. </div>
  146. </div>
  147. <div class="col-md-2">
  148. <div class="form-group">
  149. <label for="showEasing">显示动画</label>
  150. <input id="showEasing" type="text" placeholder="swing, linear" class="form-control" value="swing">
  151. </div>
  152. <div class="form-group">
  153. <label for="hideEasing">隐藏动画</label>
  154. <input id="hideEasing" type="text" placeholder="swing, linear" class="form-control" value="linear">
  155. </div>
  156. <div class="form-group">
  157. <label for="showMethod">显示方法</label>
  158. <input id="showMethod" type="text" placeholder="show, fadeIn, slideDown" class="form-control" value="fadeIn">
  159. </div>
  160. <div class="form-group">
  161. <label for="hideMethod">隐藏方法</label>
  162. <input id="hideMethod" type="text" placeholder="hide, fadeOut, slideUp" class="form-control" value="fadeOut">
  163. </div>
  164. </div>
  165. <div class="col-md-3">
  166. <div class="form-group">
  167. <label for="showDuration">显示持续时间</label>
  168. <input id="showDuration" type="text" placeholder="ms" class="form-control" value="400">
  169. </div>
  170. <div class="form-group">
  171. <label for="hideDuration">隐藏持续时间</label>
  172. <input id="hideDuration" type="text" placeholder="ms" class="form-control" value="1000">
  173. </div>
  174. <div class="form-group">
  175. <label for="timeOut">超时</label>
  176. <input id="timeOut" type="text" placeholder="ms" class="form-control" value="7000">
  177. </div>
  178. <div class="form-group">
  179. <label for="extendedTimeOut">延长时间</label>
  180. <input id="extendedTimeOut" type="text" placeholder="ms" class="form-control" value="1000">
  181. </div>
  182. </div>
  183. </div>
  184. <div class="row">
  185. <div class="col-lg-12">
  186. <button type="button" class="btn btn-primary" id="showtoast">显示Toast</button>
  187. <button type="button" class="btn btn-white" id="cleartoasts">清除所有Toast</button>
  188. <button type="button" class="btn btn-white" id="clearlasttoast">清除最后一个Toast</button>
  189. <button type="button" class="btn btn-white" id="showsimple">显示简单设置</button>
  190. </div>
  191. </div>
  192. <div class="row m-t-lg">
  193. <div class="col-lg-12">
  194. <small>Toastr JSON设置</small>
  195. <pre id="toastrOptions" class="p-m">Command: toastr[success]("Hi, welcome to hplus. This is example of Toastr notification box.")
  196. toastr.options = {
  197. "closeButton": true,
  198. "debug": true,
  199. "progressBar": false,
  200. "positionClass": "toast-top-right",
  201. "showDuration": "400",
  202. "hideDuration": "1000",
  203. "timeOut": "7000",
  204. "extendedTimeOut": "1000",
  205. "showEasing": "swing",
  206. "hideEasing": "linear",
  207. "showMethod": "fadeIn",
  208. "hideMethod": "fadeOut"
  209. }</pre>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. <script src="../js/jquery.min.js?v=2.1.4"></script>
  220. <script src="../js/bootstrap.min.js?v=3.3.6"></script>
  221. <script src="../js/content.min.js?v=1.0.0"></script>
  222. <script src="../js/plugins/toastr/toastr.min.js"></script>
  223. <script type="text/javascript">
  224. $(function(){var i=-1;var toastCount=0;var $toastlast;var getMessage=function(){var msg="Hi, welcome to Inspinia. This is example of Toastr notification box.";return msg};$("#showsimple").click(function(){toastr.success("Without any options","Simple notification!")});$("#showtoast").click(function(){var shortCutFunction=$("#toastTypeGroup input:radio:checked").val();var msg=$("#message").val();var title=$("#title").val()||"";var $showDuration=$("#showDuration");var $hideDuration=$("#hideDuration");var $timeOut=$("#timeOut");var $extendedTimeOut=$("#extendedTimeOut");var $showEasing=$("#showEasing");var $hideEasing=$("#hideEasing");var $showMethod=$("#showMethod");var $hideMethod=$("#hideMethod");var toastIndex=toastCount++;toastr.options={closeButton:$("#closeButton").prop("checked"),debug:$("#debugInfo").prop("checked"),progressBar:$("#progressBar").prop("checked"),positionClass:$("#positionGroup input:radio:checked").val()||"toast-top-right",onclick:null};if($("#addBehaviorOnToastClick").prop("checked")){toastr.options.onclick=function(){alert("You can perform some custom action after a toast goes away")}}if($showDuration.val().length){toastr.options.showDuration=$showDuration.val()}if($hideDuration.val().length){toastr.options.hideDuration=$hideDuration.val()}if($timeOut.val().length){toastr.options.timeOut=$timeOut.val()}if($extendedTimeOut.val().length){toastr.options.extendedTimeOut=$extendedTimeOut.val()}if($showEasing.val().length){toastr.options.showEasing=$showEasing.val()}if($hideEasing.val().length){toastr.options.hideEasing=$hideEasing.val()}if($showMethod.val().length){toastr.options.showMethod=$showMethod.val()}if($hideMethod.val().length){toastr.options.hideMethod=$hideMethod.val()}if(!msg){msg=getMessage()}$("#toastrOptions").text("Command: toastr["+shortCutFunction+']("'+msg+(title?'", "'+title:"")+'")\n\ntoastr.options = '+JSON.stringify(toastr.options,null,2));var $toast=toastr[shortCutFunction](msg,title);$toastlast=$toast;if($toast.find("#okBtn").length){$toast.delegate("#okBtn","click",function(){alert("you clicked me. i was toast #"+toastIndex+". goodbye!");$toast.remove()})}if($toast.find("#surpriseBtn").length){$toast.delegate("#surpriseBtn","click",function(){alert("Surprise! you clicked me. i was toast #"+toastIndex+". You could perform an action here.")})}});function getLastToast(){return $toastlast}$("#clearlasttoast").click(function(){toastr.clear(getLastToast())});$("#cleartoasts").click(function(){toastr.clear()})});
  225. </script>
  226. </body>
  227. </html>