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

                    }
                }
            });

  • 相关阅读:
    安装oracle 使用vnc无法打开terminal,解决办法
    linux服务器配置本地yum仓库
    less css 框架介绍
    html的概念
    html
    WEB前端第三十八课——js类和对象,继承,设计模式
    WEB前端第三十七课——jsBOM操作-DataParse、jsEngine、性能、history、道岔、closure
    WEB前端第三十六课——jsBOM操作-window、timer
    WEB前端第三十五课——事件绑定应用案例
    WEB前端第三十四课——js事件对象this、event
  • 原文地址:https://www.cnblogs.com/12go/p/2304722.html
Copyright © 2011-2022 走看看