下拉刷新简单模拟

来源:互联网 发布:为什么淘宝没有斐讯 编辑:程序博客网 时间:2024/05/30 13:42
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>下拉刷新简单模拟</title>
<script src="jquery-1.9.1.js"></script>
<script>
$(function(){
$("#showInfo").scroll(function(){
if($(this).height()+$(this).scrollTop()==$("#innerInfo").outerHeight(true)){
var str="<p>你好"+new Date()+"</p>"+"<p>你好"+new Date()+"</p>"+"<p>你好"+new Date()+"</p>"+"<p>你好"+new Date()+"</p>"+"<p>你好"+new Date()+"</p>";
$("#innerInfo").html( $("#innerInfo").html()+str );
}
});
});
</script>


<style>
*{
padding:0px;
margin:0px auto;
}

#showInfo{
width:200px;
height:200px;
overflow-y:scroll;
border:1px solid #F93;
}
</style>
</head>


<body>
<div id="showInfo">
    <div id="innerInfo">
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
            <p>你好,中国。</p>
         </div>
    </div>
</body>
</html>
1 0