新增下拉刷新,商户列表页body标签新增class属性

master
Lee 2022-09-06 13:15:41 +08:00
parent 74634ac755
commit 8160ff3119
2 changed files with 29 additions and 1 deletions

View File

@ -97,4 +97,32 @@ jQuery(function($){
},1000) },1000)
}) })
} }
// 定义state
var state = true;
// 查询数据
function getData(){
setTimeout(function(){
state = true;
},1000)
}
// 触底
if($('.business-body').length){
$(window).scroll(function () {
var scrollTop = $(window).scrollTop();
var windowHeight = $(window).height();
var scrollHeight = $(document).height()-50;
console.log(scrollTop + windowHeight,scrollHeight);
if (scrollTop + windowHeight > scrollHeight) {
if(state){
//此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作
     console.log("到底了,发起请求");
state = false;
getData();
}
  }
});
}
}) })

View File

@ -15,7 +15,7 @@
<script src="../js/base.js" type="text/javascript"></script> <script src="../js/base.js" type="text/javascript"></script>
<script src="../js/script.js" type="text/javascript"></script> <script src="../js/script.js" type="text/javascript"></script>
</head> </head>
<body> <body class="business-body">
<!-- 头部 --> <!-- 头部 -->
<div class="header background-00 color-ff font38 flex">商家展示</div> <div class="header background-00 color-ff font38 flex">商家展示</div>
<!-- 商户搜索 --> <!-- 商户搜索 -->