free_ajax_goods_list.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <section class="main-view tuan-index" id="goods_list">
  2. <div class="base-list-wrapper" id="tuan_list">
  3. <volist name="list" id="d">
  4. <div class="double-grid-one" onclick="location.href='{:U('/goods/'.$d['goods_id'])}'">
  5. <div class="double-grid-item gap-right">
  6. <?php if(!empty($d['fan_image'])){ ?>
  7. <img src="{$fan_ly_image}" data-echo="/Uploads/image/{$d.fan_image}" class="scrollLoading" />
  8. <?php }else { ?>
  9. <img src="{$fan_ly_image}" data-echo="{$d.image}" class="scrollLoading" />
  10. <?php } ?>
  11. <p class="goods-name">{$d.name}</p>
  12. <div class="detail">
  13. <b class="price-icon">¥</b>
  14. <b class="price">{$d.pinprice}</b>
  15. <div class="info">
  16. <span>{$d.pin_count}人团已团{$d.seller_count}件</span>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </volist>
  22. </div>
  23. </section>
  24. <div class="center" id="center_pullup" style="display:none;">
  25. <span><img class="img_rotate" src="__PUBLIC__/pinduoduo/assets/img/pull_loading_8eba142.png"/>
  26. </span><span class="orders_text"></span>
  27. </div>
  28. <style>
  29. .center {
  30. width: 170px;
  31. margin: 0 auto;
  32. text-align: center;
  33. }
  34. .img_rotate {
  35. width: 30px;
  36. height: 30px;
  37. margin-top: 7px;
  38. margin-right: 5px;
  39. -webkit-animation: loading 1s linear 0s infinite;
  40. }
  41. @-webkit-keyframes loading {
  42. 0% {
  43. -webkit-transform: rotate(0);
  44. }
  45. 100% {
  46. -webkit-transform: rotate(360deg);
  47. }
  48. }
  49. .orders_text {
  50. line-height: 45px;
  51. font-weight: 700;
  52. font-size: 15px;
  53. }
  54. </style>
  55. <script>
  56. var offset = 0;
  57. var _pa = 2;
  58. var is_can_next = 1;
  59. var cur_url = "{:U('Goods/free')}";
  60. function loaddata()
  61. {
  62. var totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop()); //浏览器的高度加上滚动条的高度
  63. if ($(document).height() <= totalheight+200) //当文档的高度小于或者等于总的高度的时候,开始动态加载数据
  64. {
  65. if(is_can_next == 1)//加载数据
  66. {
  67. is_can_next = 0;
  68. nextpage();
  69. }
  70. }
  71. }
  72. function nextpage()
  73. {
  74. var best_url = cur_url+'&page='+_pa;
  75. $('#center_pullup').show();
  76. $.ajax(
  77. {
  78. url: cur_url,
  79. type:'post',
  80. data:{page:_pa},
  81. dataType: 'json',
  82. success: function(result){
  83. if(result.code == 1)
  84. {
  85. $('#tuan_list').append(result.html);
  86. $('#center_pullup').hide();
  87. _pa++;
  88. is_can_next = 1;
  89. bindImgEvent();
  90. } else if(result.code == 0) {
  91. $('#center_pullup').remove();
  92. }
  93. }
  94. }
  95. );
  96. }
  97. $(function(){
  98. $(window).scroll( function() {
  99. loaddata();
  100. });
  101. })
  102. </script>