/*提示层js by yuncanqin 20121203*/
function msgTs(text, imgflag, parentdiv) {
//参数说明 text 提示文字
//参数说明 imgflag 提示层是否有图片,y=成功图片,n=失败图片,其他为提示无图片
//参数说明 parentdiv ,提示文字层 的父节点id,除特殊情况,一般填写"".
if (!$("#layerMs").length > 0) {
if (imgflag == "y") {
imgsrc = '<img src="/qhapp/img/ts-ok.png" alt="" width="70px"><br/>';
} else if (imgflag == "n") {
imgsrc = '<img src="/qhapp/img/ts-warn.png" alt="" width="25px" style="vertical-align:top;margin-right:5px;">';
} else {
imgsrc = '';
}
var text = imgsrc + text;
if (parentdiv != "") {
$("#" + parentdiv).append('<div id="layerMs" ></div>');
var layerMs = document.getElementById("layerMs");
layerMs.innerHTML = text;
$("#layerMs").css({
"background": "rgba(0, 0, 0, .6)",
"font-size": "16px",
"z-index": "9999999",
"position": "absolute",
"color": "#fff",
"padding": "10px 0",
"width": "100px",
"margin": "0 auto",
"padding": "10px 0",
"border-radius": "5px",
"text-align": "center"
})
} else {
$('<div id="layerMs"></div>').appendTo("body");
var layerMs = document.getElementById("layerMs");
layerMs.innerHTML = text;
$("#layerMs").css({
"background": "rgba(0, 0, 0, .6)",
"font-size": "16px",
"z-index": "9999999",
"position": "fixed",
"color": "#fff",
"padding": "10px 0",
"width": "85%",
"margin": "0 auto",
"padding": "10px 0",
"border-radius": "5px",
"text-align": "center"
})
}
layerMs.style.top = "50%";
if (imgsrc == "") {
layerMs.style.left = "50%";
layerMs.style.marginLeft = -layerMs.offsetWidth / 2 + "px";
} else {
layerMs.style.left = "50%";
layerMs.style.marginLeft = -layerMs.offsetWidth / 2 + "px";
}
layerMs.style.marginTop = -layerMs.offsetHeight / 2 + "px";
setTimeout(function() {
$("#layerMs").hide();
$("#layerMs").remove();
}, 1000);
}
}
//向下滑动加载更多
var flag = false;
var s=0;
function load_more(_html){
var timer;
$(window).scrollTop(0);
$(window).scroll(function(){
flag = true;
if (timer) clearTimeout(timer)
timer = setTimeout(function () {
var docHeight = $(document).height();
var rollHeight = $(window).height();
var scrHeight = $(window).scrollTop();
setTimeout(function () {
if(docHeight > rollHeight){
if (scrHeight >= (docHeight-rollHeight)) {
var setT = setTimeout(function(){
if(flag)
{
msgTs('上拉加载更多', '', '')
$(".table").append(_html);
flag = false;
}
},"0");
}
}
}, 1000);
}, 10);
});
}
var _html = '<tr><td>1</td><td>尹*</td><td>已付款</td></tr>';
$(function(){load_more(_html);});//_html 为加载内容