新增下拉刷新,商户列表页body标签新增class属性
parent
74634ac755
commit
8160ff3119
28
js/script.js
28
js/script.js
|
@ -97,4 +97,32 @@ jQuery(function($){
|
|||
},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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
|
@ -15,7 +15,7 @@
|
|||
<script src="../js/base.js" type="text/javascript"></script>
|
||||
<script src="../js/script.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body class="business-body">
|
||||
<!-- 头部 -->
|
||||
<div class="header background-00 color-ff font38 flex">商家展示</div>
|
||||
<!-- 商户搜索 -->
|
||||
|
|
Loading…
Reference in New Issue