一直提示“mui('#pullrefreshcontent').pullRefresh().endPullupToRefresh(true);”这句代码出错!
不知道什么原因?请大神些指点指点....谢谢~
方便大神指点,谢谢~~补充贴出源代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>List</title>
<script src="js/jquery.js"></script>
<script src="js/mui.js"></script>
<link href="css/mui.css" rel="stylesheet" />
<link href="css/comm.css" rel="stylesheet" />
</head>
<body>
<header class="mui-bar mui-bar-nav hearersceondbg">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title" id="pagetitle"></h1>
</header>
<div class="mui-content" id="bodylist">
<div class=" mui-scroll-wrapper" id="pullrefreshcontent">
<div class="contentshowIndexunit mui-scroll">
<div class="second-banner"> <img src="images/second-banner.jpg" /></div>
<div class="indexUnittit" id="proshowtit"></div>
<div class="listshow" id="descriptionid"></div>
<div class="listshow" id="backgroundid"></div>
<ul class="mui-table-view" id="vessel" style="border-bottom: 0px;">
</ul>
</div>
<div class="contentend" id="pageend" style="display: none;">---- END -----</div>
</div>
</div>
<script type="text/javascript">
var id = '';
var page = 1;
var productcount = 0;
mui.init({
pullRefresh: {
container: '#pullrefreshcontent',
up: {
contentrefresh: 'Loading...',
contentinit: '----END----',
contentdown: 'Pull-Show more',
contentnomore: '----END----',
callback: pullupRefreshConfun
}
}
});
function pullupRefreshConfun() {
if(productcount < 31) {
mui('#pullrefreshcontent').pullRefresh().endPullupToRefresh(true);
} else {
page++;
loadData();
}
}
function loadData() {
productcount = 0;
mui.ajax(apiurl + "app_get_products", {
async: true,
dataType: "json",
data: {
id: id,
page: page
},
success: function(data) {
var str = "";
var len = 0;
for(var tmp in data) {
len++;
productcount++;
}
for(var i = 0; i < len; i++) {
var tmp = data[i];
if(i == 0) {
$("#proshowtit").text(tmp["Category"]);
$("#pagetitle").text(tmp["Category"]);
var txt = tmp["Description"];
txt = txt.replace(/<a (.*?)>/ig, '');
txt = txt.replace(/<\/a>/ig, '');
$("#descriptionid").html(txt);
txt = tmp["Background"];
txt = txt.replace(/<a (.*?)>/ig, '');
txt = txt.replace(/<\/a>/ig, '');
$("#backgroundid").html(txt);
continue;
}
if(tmp["Structure"] == "")
tmp["Structure"] = "images/default-pic.png";
var img = "<img class='mui-media-object mui-pull-left' src='" + tmp["Structure"] + "' />"
var p = "<p class='mui-ellipsis'>Cas:" + tmp["CAS Number"] + "</p>";
var div = "<div class='ui-media-body mui-ellipsis'>" + tmp["Product Name"] + "" + p + "</div>";
str += "<li class='mui-table-view-cell mui-media'><a class='mui-navigate-right' href='show.html?id=" + tmp["ID"] + "'>" +img+ div + "</a></li>";
}
str = $("#vessel").html() + str;
$("#vessel").html(str);
//alert($("#vessel").html());
if(productcount < 31) {
mui('#pullrefreshcontent').pullRefresh().endPullupToRefresh(true);
} else{
mui('#pullrefreshcontent').pullRefresh().endPullupToRefresh(false);
}
},
error: function(data) {
mui.toast("error");
}
});
}
function plusReady() {
var t = window.location.search;
var len = t.length;
id = t.substring(t.indexOf("=", 0) + 1, len);
id = decodeURIComponent(id);
loadData();
mui('#bodylist').on('tap', 'a', function() {
var id = this.getAttribute('href');
var href = this.href;
var webview_style = {
popGesture: "close"
};
mui.openWindow({
id: id,
url: this.href,
styles: webview_style,
show: {
aniShow: 'none'
},
waiting: {
autoShow: false
}
});
});
}
if(window.plus) {
plusReady();
} else {
document.addEventListener("plusready", plusReady, false);
}
</script>
</body>
</html>