You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

184 lines
4.9 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  8. <title>健康资讯</title>
  9. <script src="jquery.min.js"/></script>
  10. <script type="text/javascript" src="iscroll.js"></script>
  11. <link rel="stylesheet" type="text/css" href="bookBase.css" />
  12. <!--start-->
  13. <style>
  14. html, body{ background-color: #fff;}
  15. .m-img-font-box{}
  16. .m-img-font-box a.link{ display: block; border-bottom: 1px solid #ccc;}
  17. .m-img-font-box a.link dl{ padding: 5px 10px; height: 50px; overflow: hidden;}
  18. .m-img-font-box a.link dl dt{ width: 60px; height: 60px; float: left;}
  19. .m-img-font-box a.link dl dt img{ width: 100%; height: 82%;}
  20. .m-img-font-box a.link dl dd{ margin-left: 65px; padding-top: 1px;}
  21. .m-img-font-box a.link dl dd p{ font-size: 16px; color: #bbb;}
  22. .m-img-font-box a.link dl dd p.title{ font-size: 16px; color: #464646; width: 91%; overflow: hidden; text-overflow:ellipsis; white-space:nowrap;}
  23. .m-img-font-box a.link dl dd p.font{ width: 98%; overflow: hidden; text-overflow:ellipsis; white-space:nowrap; font-size: 14px;}
  24. h3{ font-size: 13px; font-weight: normal; padding: 5px 10px;}
  25. #wrapper {
  26. position:absolute; z-index:1;
  27. top:30px; bottom:0; left:-9999px;
  28. width:100%;
  29. background:#FFF;
  30. overflow:auto;
  31. }
  32. #scroller {
  33. position:absolute; z-index:1;
  34. -webkit-tap-highlight-color:rgba(0,0,0,0);
  35. width:100%;
  36. padding:0;
  37. }
  38. #pullUp {
  39. background:#fff;
  40. height:40px;
  41. line-height:40px;
  42. padding:5px 10px;
  43. border-bottom:1px solid #ccc;
  44. font-weight:bold;
  45. font-size:14px;
  46. color:#888;
  47. }
  48. #pullUp.loading .pullUpLabel {
  49. background:url(../images/loading/loading.gif) no-repeat center 0;
  50. width: 100%;
  51. height: 30px;
  52. align:center;
  53. background-size: auto 100%;
  54. }
  55. </style>
  56. <script type="text/javascript">
  57. var myScroll,
  58. pullUpEl, pullUpOffset,
  59. generatedCount = 0;
  60. var currenPage = 0; var pageSize = 3;
  61. function pullUpAction () {
  62. currenPage ++;
  63. var elInit = $("#thelist");
  64. var param = {"currentPage":currenPage,"pageSize":pageSize};
  65. $.ajax({
  66. url:"result.json", //后台处理程序
  67. type:'post', //数据发送方式
  68. dataType: 'json',
  69. data:param,
  70. async: true,
  71. success:function(data){
  72. var result = "" ;
  73. $(data).each(function(){
  74. var checker = $(this)[0];
  75. result += "<div class='mfb'><a class='link' href='"+checker.url+"'>"+
  76. "<dl><dt><img src='"+checker.icon+"'/> </dt>"+
  77. "<dd><p class='title'>"+checker.title+"</p>"+
  78. "<p class='title'>"+checker.subTitle+"</p>"+
  79. "</dd></dl></a></div>";
  80. });
  81. elInit.append(result);
  82. myScroll.refresh();
  83. }
  84. });
  85. }
  86. function loaded() {
  87. pullUpEl = document.getElementById('pullUp');
  88. if(pullUpEl != null){
  89. pullUpOffset = pullUpEl.offsetHeight;
  90. }else{
  91. pullUpOffset = 0;
  92. }
  93. myScroll = new iScroll('wrapper', {
  94. useTransition: true,
  95. onRefresh: function () {
  96. if (pullUpEl.className.match('loading')) {
  97. pullUpEl.className = '';
  98. $(pullUpEl).css("display", "none");
  99. pullUpEl.querySelector('.pullUpLabel').innerHTML = 'Pull up to load more...';
  100. }
  101. },
  102. onScrollMove: function () {
  103. if (this.y < (this.maxScrollY - 5) && !pullUpEl.className.match('flip')) {
  104. pullUpEl.className = 'flip';
  105. $(pullUpEl).css("display","");
  106. pullUpEl.querySelector('.pullUpLabel').innerHTML = '松开载入更多..';
  107. this.maxScrollY = this.maxScrollY;
  108. } else if (this.y > (this.maxScrollY + 5) && pullUpEl.className.match('flip')) {
  109. pullUpEl.className = '';
  110. pullUpEl.querySelector('.pullUpLabel').innerHTML = 'Pull up to load more...';
  111. this.maxScrollY = pullUpOffset;
  112. }
  113. },
  114. onScrollEnd: function () {
  115. if (pullUpEl.className.match('flip')) {
  116. pullUpEl.className = 'loading';
  117. $(pullUpEl).css("display","");
  118. pullUpEl.querySelector('.pullUpLabel').innerHTML = '';
  119. pullUpAction(); // Execute custom function (ajax call?)
  120. }
  121. }
  122. });
  123. document.getElementById('wrapper').style.left = '0';
  124. }
  125. document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
  126. document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);
  127. $(function(){
  128. pullUpAction();
  129. });
  130. </script>
  131. </style>
  132. </head>
  133. <body>
  134. <h3>资讯列表</h3>
  135. <div class="cm-container-box" id="wrapper">
  136. <div class="cm-table" id="scroller">
  137. <div class="m-img-font-box" id="thelist">
  138. </div>
  139. <div id="pullUp" style="display:none; text-align: center;">
  140. <span class="pullUpLabel"></span>
  141. </div>
  142. </div>
  143. </div>
  144. </body>
  145. </html>