Chinaunix首页 | 论坛 | 博客
  • 博客访问: 843349
  • 博文数量: 372
  • 博客积分: 10063
  • 博客等级: 中将
  • 技术积分: 4220
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-24 11:36
文章分类

全部博文(372)

文章存档

2012年(372)

分类: 虚拟化

2012-04-21 21:55:52

复制代码
<html xmlns=""> <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中 $('
' + i + '
').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>
复制代码
阅读(669) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~