dialog.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>jQuery WeUI</title>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  8. <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
  9. ">
  10. <link rel="stylesheet" href="../lib/weui.min.css">
  11. <link rel="stylesheet" href="../css/jquery-weui.css">
  12. <link rel="stylesheet" href="css/demos.css">
  13. </head>
  14. <body ontouchstart>
  15. <header class='demos-header'>
  16. <h1 class="demos-title">对话框</h1>
  17. </header>
  18. <div class='demos-content-padded'>
  19. <a href="javascript:;" id='show-alert' class="weui-btn weui-btn_primary">显示 Alert</a>
  20. <a href="javascript:;" id='show-confirm' class="weui-btn weui-btn_primary">显示 Confirm</a>
  21. <a href="javascript:;" id='show-prompt' class="weui-btn weui-btn_primary">显示 Prompt</a>
  22. <a href="javascript:;" id='show-login' class="weui-btn weui-btn_primary">显示登录弹窗</a>
  23. <a href="javascript:;" id='show-custom' class="weui-btn weui-btn_primary">显示自定义对话框</a>
  24. </div>
  25. <script src="../lib/jquery-2.1.4.js"></script>
  26. <script src="../lib/fastclick.js"></script>
  27. <script>
  28. $(function() {
  29. FastClick.attach(document.body);
  30. });
  31. </script>
  32. <script src="../js/jquery-weui.js"></script>
  33. <script>
  34. $(document).on("click", "#show-alert", function() {
  35. $.alert("AlphaGo 就是天网的前身,人类要完蛋了!", "警告!");
  36. });
  37. $(document).on("click", "#show-confirm", function() {
  38. $.confirm("您确定要删除文件<<毛泽东语录>>吗?", "确认删除?", function() {
  39. $.toast("文件已经删除!");
  40. }, function() {
  41. //取消操作
  42. });
  43. });
  44. $(document).on("click", "#show-prompt", function() {
  45. $.prompt({
  46. text: "名字不能超过6个字符,不得出现不和谐文字",
  47. title: "输入姓名",
  48. onOK: function(text) {
  49. $.alert("您的名字是:"+text, "角色设定成功");
  50. },
  51. onCancel: function() {
  52. console.log("取消了");
  53. },
  54. input: 'Mr Noone'
  55. });
  56. });
  57. $(document).on("click", "#show-custom", function() {
  58. $.modal({
  59. title: "Hello",
  60. text: "我是自定义的modal",
  61. buttons: [
  62. { text: "支付宝", onClick: function(){ $.alert("你选择了支付宝"); } },
  63. { text: "微信支付", onClick: function(){ $.alert("你选择了微信支付"); } },
  64. { text: "取消", className: "default"},
  65. ]
  66. });
  67. });
  68. $(document).on('click', '#show-login', function() {
  69. $.login({
  70. title: '登录',
  71. text: '请输入用户名和密码',
  72. onOK: function (username, password) {
  73. console.log(username, password);
  74. $.toast('登录成功!');
  75. },
  76. onCancel: function () {
  77. $.toast('取消登录!', 'cancel');
  78. }
  79. });
  80. });
  81. </script>
  82. </body>
  83. </html>