国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 荣昌县| 绵竹市| 遵义县| 齐河县| 永济市| 中西区| 乐陵市| 滦平县| 景东| 洛扎县| 泗洪县| 饶阳县| 六盘水市| 仪陇县| 偏关县| 女性| 通许县| 高雄市| 金门县| 宁南县| 通渭县| 沅江市| 平邑县| 白朗县| 得荣县| 景洪市| 砀山县| 大同市| 澜沧| 德昌县| 清徐县| 江油市| 千阳县| 鹤岗市| 德安县| 松溪县| 察哈| 蕉岭县| 柏乡县| 登封市| 镇安县|