原生移动上拉下啦刷新加载更d

来源:互联网 发布:东方project mac版 编辑:程序博客网 时间:2024/06/07 03:39


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
    color#FFF;
    border0px;
    border-radius5px;
    floatright;
    margin1.7em 0px;
}
</style>
</head>
<body>
<!---->
<div id="wrapper" style="height:50em;">
  <ul id="gameList">
  </ul>
</div>
<!--JS--> 
<script type="text/javascript">
var upDown=function(opt){
    debugger
    opt = opt || {};
    var ele = opt.ele || 'container';
    var up = opt.up || function(){};
    var down = opt.down || function () {};
    /**/
    document.getElementById(ele).onscroll=function(){
        var scrollTop =this.scrollTop; //   ——
        var ziHeight = this.scrollHeight;   //                  
        var fuHeight = this.clientHeight;           //
        if(scrollTop + fuHeight +50 >= ziHeight) { //+ >= 
            up();
        } else if(scrollTop <= 50) { //0
标签:
  • 原生js
  • 移动端
  • 上拉加载下拉刷
原创粉丝点击