Browse Source

修改下拉刷新

xuchunyang 8 years ago
parent
commit
26dfd95691
1 changed files with 36 additions and 29 deletions
  1. 36 29
      app/js/discover.js

+ 36 - 29
app/js/discover.js

@ -100,26 +100,43 @@ mui('#discoverBox').on('tap', '.gouserurl', function() {
100 100

101 101
/*页面数据初始化*/
102 102
getOnePase();
103
if(mui.os.plus) {
104
	var height = 190;
105
} else {
106
	var height = 0;
103

104
var u = navigator.userAgent;
105
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
106
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
107
if(isAndroid) {
108
	//父子页面,下拉刷新
109
	mui.init({
110
		pullRefresh: {
111
			container: '#pullrefresh2',
112
			down: {
113
				callback: pulldownRefresh,
114
				height:190
115
			},
116
			up: {
117
				contentrefresh: '正在加载...',
118
				callback: pullupRefresh
119
			}
120
		}
121
	});
107 122
}
108
mui.init({
109
	pullRefresh: {
110
		container: '#pullrefresh2',
111
		down: {
112
			callback: pulldownRefresh,
113
			height:height
114
		},
115
		up: {
116
			contentrefresh: '正在加载...',
117
			//auto:true,
118
			//height:100, 
119
			callback: pullupRefresh
123
if(isiOS) {
124
	//父子页面,下拉刷新
125
	mui.init({
126
		pullRefresh: {
127
			container: '#pullrefresh2',
128
			down: {
129
				callback: pulldownRefresh,
130
			},
131
			up: {
132
				contentrefresh: '正在加载...',
133
				//auto:true,
134
				//height:100, 
135
				callback: pullupRefresh
136
			}
120 137
		}
121
	}
122
});
138
	});
139
}
123 140

124 141
function pullupRefresh() {
125 142
	pageIndex = ++pageIndex;
@ -134,17 +151,7 @@ function pulldownRefresh() {
134 151
	}, 1000);
135 152
}
136 153

137
if(mui.os.plus) {
138
	mui.plusReady(function() {
139
		setTimeout(function() {
140
			mui('#pullrefresh2').pullRefresh().pulldownLoading();
141
		}, 500);
142
	});
143
} else {
144
	mui.ready(function() {
145
		mui('#pullrefresh2').pullRefresh().pulldownLoading();
146
	});
147
}
154

148 155
/*时间转换*/
149 156
function Time(dealtime) {
150 157
	var s = dealtime;