bootstrap.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>jQuery UI Portlet</title>
  6. <link rel="stylesheet" href="../lib/bootstrap/css/bootstrap.min.css" />
  7. <!-- jquery 1.4 and jquery ui 1.8 -->
  8. <link rel="stylesheet" href="../lib/themes/bootstrap/jquery-ui-1.8.16.custom.css" />
  9. <link rel="stylesheet" href="../lib/themes/bootstrap/jquery.ui.1.8.16.ie.css" />
  10. <link rel="stylesheet" href="../css/jquery.portlet.css?v=1.1.3" />
  11. <script src="../lib/jquery-1.4.4.min.js" type="text/javascript"></script>
  12. <script src="../lib/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
  13. <!--<link rel="stylesheet" href="../lib/themes/1.9/start/jquery-ui-1.9.1.custom.min.css" />-->
  14. <!--<script src="../lib/jquery-1.8.3.js" type="text/javascript"></script>-->
  15. <!--<script src="../lib/themes/jquery-ui-1.9.1.custom.min.js" type="text/javascript"></script>-->
  16. <script src="../script/jquery.portlet.pack.js?v=1.1.3"></script>
  17. <style>
  18. body {font-size: 13px;}
  19. .highlight-content {color: red;}
  20. </style>
  21. <script>
  22. $(function() {
  23. $('#portlet-demo').portlet({
  24. sortable: true,
  25. create: function() {
  26. //alert('created portlet.');
  27. },
  28. removeItem: function() {
  29. alert('after remove');
  30. },
  31. columns: [{
  32. width: 400,
  33. portlets: [{
  34. attrs: {
  35. id: 'feeds'
  36. },
  37. title: function() {
  38. var d = new Date();
  39. return 'Feeds(' + (d.getMonth() + 1) + '-' + d.getDay() + '日)';
  40. },
  41. icon: 'ui-icon-signal-diag',
  42. content: {
  43. //设置区域内容属性
  44. style: {
  45. height: '100'
  46. },
  47. type: 'text',
  48. text: '<ul><li>Feed item 1</li><li>Feed item 2</li></ul>',
  49. beforeShow: function(aa) {
  50. //alert('before show, content is: ' + aa);
  51. },
  52. afterShow: function() {
  53. //alert('after show');
  54. }
  55. },
  56. scripts: ['loaded-by-portlet.js']
  57. }, {
  58. attrs: {
  59. id: 'news'
  60. },
  61. title: '主题整合支持',
  62. beforeRefresh: function() {
  63. alert("before refresh");
  64. },
  65. afterRefresh: function(data) {
  66. //alert("after refresh: " + data);
  67. },
  68. content: {
  69. style: {
  70. height: '300'
  71. },
  72. type: 'text',
  73. text: function() {
  74. return $('#newsTemplate').html();
  75. //return $('#newsTemplate ul');
  76. }
  77. }
  78. }]
  79. }, {
  80. width: 350,
  81. portlets: [{
  82. title: 'Code',
  83. content: {
  84. type: 'text',
  85. text: function() {
  86. return $('#code').html();
  87. }
  88. }
  89. }, {
  90. title: 'Ajax 错误',
  91. content: {
  92. type: 'ajax',
  93. url: 'noexsit.html',
  94. error: function() {
  95. $(this).append('<br/><br/>捕获到ajax错误');
  96. // alert('出错了');
  97. }
  98. }
  99. }, {
  100. title: 'Table',
  101. content: {
  102. type: 'text',
  103. text: function() {
  104. return $('#tableTemplate').html();
  105. }
  106. }
  107. }]
  108. }]
  109. });
  110. });
  111. </script>
  112. </head>
  113. <body>
  114. <div class="ui-state-highlight ui-corner-all" style="padding: 0 .7em;">
  115. <p>
  116. <i class="icon-heart"></i>使用Bootstrap主题(由jQuery UI的Bootstrap主题风格支持)
  117. </p>
  118. </div>
  119. <hr class='ui-widget-content' />
  120. <div id='portlet-demo'></div>
  121. <!-- 模板 -->
  122. <div id="newsTemplate" style="display:none">
  123. <a href="http://addyosmani.github.com/jquery-ui-bootstrap/">http://addyosmani.github.com/jquery-ui-bootstrap/</a>
  124. <hr/>
  125. <p class="text-warning">警告信息。</p>
  126. <p class="text-error">错误信息。</p>
  127. <p class="text-info">提示信息。</p>
  128. <p class="text-success">成功信息。</p>
  129. <button class="btn btn-primary">Bootstrap的按钮</button>
  130. </div>
  131. <div id="tableTemplate" style="display:none">
  132. <table class="table table-bordered table-hover">
  133. <thead>
  134. <tr>
  135. <th>#</th>
  136. <th>First Name</th>
  137. <th>Last Name</th>
  138. <th>Username</th>
  139. </tr>
  140. </thead>
  141. <tbody>
  142. <tr>
  143. <td>1</td>
  144. <td>Mark</td>
  145. <td>Otto</td>
  146. <td>@mdo</td>
  147. </tr>
  148. <tr>
  149. <td>2</td>
  150. <td>Jacob</td>
  151. <td>Thornton</td>
  152. <td>@fat</td>
  153. </tr>
  154. <tr>
  155. <td>3</td>
  156. <td>Larry</td>
  157. <td>the Bird</td>
  158. <td>@twitter</td>
  159. </tr>
  160. </tbody>
  161. </table>
  162. </div>
  163. <div id="code" style="display:none">
  164. <code>.highlight-content {color: red;}</code>
  165. </div>
  166. </body>
  167. </html>