下拉刷新

This commit is contained in:
2018-04-18 15:04:11 +08:00
parent ab3595b53f
commit 4a3a52ec9d
2 changed files with 35 additions and 2 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="css/mui.css">
<link rel="stylesheet" href="css/mui.min.css">
<link rel="stylesheet" href="css/main.css">
<style>
.mui-bar-tab{background:#fff;box-shadow:none;}
+34 -1
View File
@@ -19,6 +19,8 @@
.cardInfo:first-child{border-top:none;}
.info-container input{float:none;width:100%;}
.picker-item{padding:0 5rem;font-size:18px;}
.pull-to-refresh-layer .preloader{visibility: visible; }
</style>
</head>
@@ -42,7 +44,13 @@
<input id="address" name = "address" type="hidden"/>
</div>
</div>
<div class="content infinite-scroll infinite-scroll-bottom pstion" data-distance="50">
<div class="content infinite-scroll infinite-scroll-bottom pstion pull-to-refresh-content" data-distance="50" data-ptr-distance="30">
<!-- 默认的下拉刷新层 -->
<div class="pull-to-refresh-layer dn">
<div class="preloader"></div>
<!--<div class="pull-to-refresh-arrow"></div>-->
</div>
<div class="card cardPrice" id="baseInfo" v-cloak>
<div class="card-header">
<span>{{topMonth}}月份均价</span>
@@ -114,6 +122,8 @@
<div id="newsList">
</div>
<div class="infinite-scroll-preloader">
<div class="preloader"></div>
</div>
@@ -1550,6 +1560,9 @@ function initNews(page){
lastIndex = $('.cardInfo').length;
itemsPerLoad = response.data.data.list.length;
addItems(itemsPerLoad, lastIndex);
$(".pull-to-refresh-layer").addClass("dn");
/*if(dataObj.length>5){
$(".infinite-scroll-preloader").show();
}else{
@@ -2001,6 +2014,23 @@ $(document).on('infinite', '.infinite-scroll-bottom',function() {
}, 500);
});
// 添加'refresh'监听器
$(document).on('refresh', '.pull-to-refresh-content',function(e) {
if($("#input_city").text()=="上海"){
$(".pull-to-refresh-layer").removeClass("dn");
page = 1;
dataObj = [];
$("#newsList").html("");
initNews(page);
// 加载完毕需要重置
$.pullToRefreshDone('.pull-to-refresh-content');
}
});
function regionChange(region){
var text = region;
var length = region.length;
@@ -2664,6 +2694,9 @@ $("body").delegate("#hotList ul li", "click", function () {
//clicked(url, true);
});
</script>
</body>