zoukankan      html  css  js  c++  java
  • 随滚动条来加载可见屏幕内容的代码示例

    $(document).ready(function() {
                $(window).bind(
    "scroll", GetData);

               
    function GetData() {
                   
                   
    var windowHeight = $(window).height();
                   
    var scrollHeight = $(document).scrollTop();
                   
    var screenBottom = windowHeight + scrollHeight;
                   
    var documentHeight = $(document).height();
                   
    if (screenBottom >= documentHeight) {
                        $(window).unbind();
                        $.ajax({
                            type:
    "post",
                            url:
    "GetData.aspx",
                            data:
    "action=data",
                            success:
    function(data) {
                                data
    = eval("("+ data +")");
                               
    if (data.ret =1) {
                                   
    var html ="";
                                   
    for (var i =0; i <12; i++) {
                                        html
    +='<div style=" border:1px solid; 198px; float:left; height:200px" >'+ i +'</div>';
                                    }
                                    $(
    "#div_main").append(html);
                                    $(window).bind(
    "scroll", GetData);
                                }
                            }
                        })

                    }
                }
            });

  • 相关阅读:
    call和applay
    判断传入的参数是否包含空
    通过函数修改文件中指定字符串
    任一个英文的纯文本文件,统计其中的每个单词出现的个数(注意是每个单词)
    下载进度条实现
    Python 用户登录判断,数据结构-字典
    python 字符串(str)和列表(list)互相转换
    网络编程01
    OpenGL入门学习
    程序的音频输出
  • 原文地址:https://www.cnblogs.com/12go/p/2304722.html
Copyright © 2011-2022 走看看