国产探花免费观看_亚洲丰满少妇自慰呻吟_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教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 瑞丽市| 罗源县| 章丘市| 涞源县| 天等县| 庆城县| 岳阳市| 泽州县| 滕州市| 万宁市| 射洪县| 秦安县| 石河子市| 宜黄县| 宝丰县| 中牟县| 安庆市| 长丰县| 康保县| 乐业县| 蒙阴县| 余姚市| 汶川县| 庆安县| 益阳市| 迁安市| 虎林市| 夏邑县| 渭源县| 丹寨县| 沾益县| 文山县| 洛宁县| 应城市| 永胜县| 盘锦市| 慈溪市| 佳木斯市| 始兴县| 手机| 苏尼特左旗|