colspan.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>jQuery UI Portlet</title>
  6. <!-- jquery 1.4 and jquery ui 1.8 -->
  7. <link rel="stylesheet" href="../lib/themes/1.8/start/jquery-ui-1.8.5.custom.css" />
  8. <link rel="stylesheet" href="../css/jquery.portlet.css?v=1.1.3" />
  9. <script src="../lib/jquery-1.4.4.min.js" type="text/javascript"></script>
  10. <script src="../lib/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
  11. <!--<link rel="stylesheet" href="../lib/themes/1.9/start/jquery-ui-1.9.1.custom.min.css" />-->
  12. <!--<script src="../lib/jquery-1.8.3.js" type="text/javascript"></script>-->
  13. <!--<script src="../lib/themes/jquery-ui-1.9.1.custom.min.js" type="text/javascript"></script>-->
  14. <script src="../script/jquery.portlet.pack.js"></script>
  15. <style>
  16. body {font-size: 13px;}
  17. .highlight-content {color: red;}
  18. </style>
  19. <script>
  20. $(function() {
  21. $('#portlet-demo').portlet({
  22. sortable: true,
  23. singleView: true,
  24. columns: [{
  25. width: 350,
  26. portlets: [{
  27. attrs: {
  28. id: 'feeds'
  29. },
  30. title: function() {
  31. var d = new Date();
  32. return '正常宽度';
  33. },
  34. icon: 'ui-icon-signal-diag',
  35. content: {
  36. //设置区域内容属性
  37. style: {
  38. height: 100
  39. },
  40. type: 'text',
  41. text: '这里是内容。。。。。'
  42. }
  43. }]
  44. }, {
  45. width: 350,
  46. portlets: [{
  47. attrs: {
  48. id: 'news'
  49. },
  50. title: function() {
  51. return '内容二';
  52. },
  53. icon: 'ui-icon-document',
  54. content: {
  55. style: {
  56. height: 100
  57. },
  58. type: 'text',
  59. text: '这里是内容。。。。。'
  60. }
  61. }]
  62. }]
  63. });
  64. $('#portlet-demo1').portlet({
  65. sortable: true,
  66. singleView: true,
  67. columns: [{
  68. width: 700,
  69. portlets: [{
  70. attrs: {
  71. id: 'aaaa'
  72. },
  73. title: function() {
  74. var d = new Date();
  75. return '跨2列';
  76. },
  77. icon: 'ui-icon-signal-diag',
  78. content: {
  79. //设置区域内容属性
  80. style: {
  81. height: 100
  82. },
  83. afterShow: function() {
  84. var top = 0;
  85. var left = 0;
  86. var index = $(this).index('.ui-portlet');
  87. var topp = $('.ui-portlet').eq(index == 0 ? 0 : index - 1).find('.ui-portlet-column');
  88. $.each(topp, function() {
  89. if (top < $(this).height()) {
  90. top = $(this).height();
  91. }
  92. });
  93. $(this).css('position', 'absolute').css({
  94. left: 7,
  95. top: top + 10
  96. });
  97. },
  98. type: 'text',
  99. text: '我要跨列...'
  100. }
  101. }]
  102. }]
  103. });
  104. });
  105. </script>
  106. </head>
  107. <body>
  108. <hr class='ui-widget-content' />
  109. <div id='portlet-demo'></div>
  110. <div id='portlet-demo1'></div>
  111. <!-- 模板 -->
  112. <div id="newsTemplate" style="display:none">
  113. <ul>
  114. <li><a href='http://www.kafeitu.me/'>http://www.kafeitu.me</a></li>
  115. <li><a href='https://github.com/henryyan'>https://github.com/henryyan</a></li>
  116. </ul>
  117. </div>
  118. </body>
  119. </html>