国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jQuery實(shí)現(xiàn)模仿微博下拉滾動條加載數(shù)據(jù)效果

2019-11-20 10:55:56
字體:
供稿:網(wǎng)友

本文實(shí)例講述了jQuery實(shí)現(xiàn)模仿微博下拉滾動條加載數(shù)據(jù)效果。分享給大家供大家參考,具體如下:

<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>滾動條距離底部</title> <script src="jquery-1.6.2.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { var i = 4; $(window).bind("scroll", function (event) { //滾動條到網(wǎng)頁頭部的 高度,兼容ie,ff,chrome var top = document.documentElement.scrollTop + document.body.scrollTop; //網(wǎng)頁的高度 var textheight = $(document).height(); // 網(wǎng)頁高度-top-當(dāng)前窗口高度  if (textheight - top - $(window).height() <= 100) { if (i >= 100) { return; //控制最大只能加載到100 } $('#div1').css("height", $(document).height() + 100); i++;  //可以根據(jù)實(shí)際情況,獲取動態(tài)數(shù)據(jù)加載 到 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> 1</div> <div> 2</div> <div> 3</div> <div> 4</div> </div> </form> </body> </html> 

希望本文所述對大家jQuery程序設(shè)計有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 长子县| 镇赉县| 辽宁省| 塘沽区| 建平县| 三原县| 岗巴县| 珲春市| 万盛区| 安岳县| 博湖县| 津南区| 湖南省| 康定县| 德清县| 若羌县| 微山县| 丁青县| 延津县| 荃湾区| 长葛市| 曲松县| 邯郸市| 罗田县| 芒康县| 龙井市| 徐水县| 天祝| 璧山县| 凤城市| 淳安县| 平江县| 镇坪县| 宁德市| 常州市| 施秉县| 石景山区| 北票市| 凌海市| 出国| 富宁县|