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

首頁 > 開發 > JS > 正文

JS簡單實現滑動加載數據的方法示例

2024-05-06 16:40:23
字體:
來源:轉載
供稿:網友

本文實例講述了JS簡單實現滑動加載數據的方法。分享給大家供大家參考,具體如下:

//滑動function getScrollTop(){ var scrollTop = 0; if (document.documentElement && document.documentElement.scrollTop) {   scrollTop = document.documentElement.scrollTop;  }else if (document.body) {  scrollTop = document.body.scrollTop;  }  return scrollTop;}//獲取當前可視范圍的高度function getClientHeight(){ var clientHeight = 0; if (document.body.clientHeight && document.documentElement.clientHeight) {   clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight); }else {   clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight); }   return clientHeight;}//獲取文檔完整的高度function getScrollHeight(){   return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);}//綁定事件window.onscroll = function (){ if (getScrollTop() + getClientHeight() == getScrollHeight()) {  //dosomething }}

 

希望本文所述對大家JavaScript程序設計有所幫助。


注:相關教程知識閱讀請移步到JavaScript/Ajax教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 抚远县| 永州市| 台东县| 垦利县| 新和县| 承德县| 景谷| 玉门市| 安岳县| 平顶山市| 泽州县| 敦煌市| 通化市| 额敏县| 鄱阳县| 饶平县| 漳州市| 天柱县| 桐乡市| 当涂县| 淄博市| 安远县| 潮州市| 永吉县| 安陆市| 全州县| 邓州市| 象山县| 凉城县| 嵩明县| 九龙坡区| 漳州市| 田东县| 扎兰屯市| 尼勒克县| 府谷县| 禄丰县| 新源县| 佛坪县| 个旧市| 慈利县|