作家
登录

拉动滚动条加载数据的jquery代码

作者: 来源:www.28hudong.com 2013-03-30 00:29:54 阅读 我要评论

复制代码 代码如下: <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中 $('<div>' + i + '</div>').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> </div> <div> </div> <div> </div> <div> </div> </div> </form> </body> </html>

  推荐阅读

  iphone safari不支持position fixed的解决方法

需求是这样的,许多pc web页面的导航都是固定的,比如google的首页,现在要将这种固定的导航转移到mobile web下,很自然地就会想到position:fixed; bottom: 0,android下运行正常,但在iphone safari下就会出现问>>>详细阅读


本文标题:拉动滚动条加载数据的jquery代码

地址:http://www.17bianji.com/kaifa2/JS/23455.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)