<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>拉动滚动条加载数据title> <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript">script> <script type="text/javascript"> $(function () { var i = 4;$(window).bind("scroll", function (event) { //滚动条到网页头部的 高度,兼容ie,ff,chrome var top = document.documentElement.scrollTop + document.body.scrollTop; //网页的高度 var textheight = $(document).height(); // 网页高度-top-当前窗口高度 if (textheight - top - $(window).height() <= 100) { if (i >= 100) { return; //控制最大只能加载到100 } $('#div1').css("height", $(document).height() + 100);i++; //可以根据实际情况,获取动态数据加载 到 div1中 $('
').appendTo($('#div1')); } }); }) script> <style> #div1 div { font-size: 100px; background: #ccc; margin-top: 5px; } style> head> <body> <form id="form1" runat="server"> <div style="height: 1000px;" id="div1"> <div> 1div> <div> 2div> <div> 3div> <div> 4div> div> form> body> html>
推荐文章
2021-01-20 18:23:14
2021-01-22 17:24:38
2021-01-25 17:06:11
2021-01-28 17:37:27
2021-02-01 17:32:55
2021-02-03 17:41:37
2021-02-05 17:23:07
2021-02-08 16:59:58
稳定
产品可用性高于99.9%贴心
全国7*24小时客服热线专业
产品经理在线技术支持快速
快速上线运营快承诺
我们选择声誉坚持
10年专注高端品质开发