单webview上拉刷新下拉加载
单个页面:
<div id="pullrefresh" class="mui-content mui-scroll-wrapper" pageNumber="0" totalPages="0"> <div class="mui-scroll" id="content">
</div> </div>
js:
initPullRefresh("#pullrefresh");
function initPullRefresh(selector) { mui(selector).pullRefresh({ container: selector, //下拉刷新容器标识,querySelector能定位的css选择器均可,比如:id、.class等 down: { callback: pulldownRefresh //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据; }, up: { callback: pullupRefresh //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据; } }); $(selector).on("tap", "#batteryChargingStation", function() { mui.openWindow({ url: 'map.html', id: 'map.html' }); }); $(selector).on("tap", ".batteryCharging", function() { mui.openWindow({ url: 'mapelse.html', id: 'mapelse.html' }); }); $(selector).on("tap", ".adimgs", function() { var data = { id: $(this).attr('data-id') }; goPagead('adInfo.html', data); }); }
function goPagead(page, data) {
mui.openWindow({
url: page,
id: page,
extras: {
data: data
}
});
}