• 随滚动条来加载可见屏幕内容的代码示例


    $(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);
                                }
                            }
                        })

                    }
                }
            });

  • 相关阅读:
    git 基本使用
    docker下rabbitMQ高可用集群部署
    成长路上破局思维:工具化时间管理
    图解Elasticsearch的核心概念
    先森林后树木:Elasticsearch各版本升级核心内容必看
    JRebel 破解最简单的使用
    POA理论:不要被你的目标欺骗了你
    读了《跃迁-成为高手的技术》我的工资翻倍了
    微信头像地址失效踩坑记附带方案
    如何做程序员喜欢的测试妹子?
  • 原文地址:https://www.cnblogs.com/12go/p/2304722.html
Copyright © 2020-2023  润新知