页面滚动条翻页
来源:互联网 发布:苏州海默淘宝开店培训 编辑:程序博客网 时间:2024/05/21 12:46
function getWindowHeight() {
var windowHeight = 0; if (document.compatMode == "CSS1Compat") {
windowHeight = document.documentElement.clientHeight;
} else {
windowHeight = document.body.clientHeight;
}
return windowHeight;
}
//滚动条滚动高度
function getScrollHeight() {
var scrollHeight = 0, bodyScrollHeight = 0, documentScrollHeight = 0;
if (document.body) {
bodyScrollHeight = document.body.scrollHeight;
}
if (document.documentElement) {
documentScrollHeight = document.documentElement.scrollHeight;
}
scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight; return scrollHeight;
}
//文档高度
function getDocumentTop() {
var scrollTop = 0, bodyScrollTop = 0, documentScrollTop = 0;
if (document.body) {
bodyScrollTop = document.body.scrollTop;
}
if (document.documentElement) {
documentScrollTop = document.documentElement.scrollTop;
}
scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop; return scrollTop;
}
var p = 1 ;
window.onscroll = function () {
//监听事件内容
if(getScrollHeight() == getWindowHeight() + getDocumentTop()){
str = "";
//当滚动条到底时,这里是触发内容
//异步请求数据,局部刷新dom
//if(tag==1) return false;
p++;
fyurl = "请求翻页的接口地址?p="+p; //p为当前页数
$.ajax({url:fyurl,type : "get",async : false,dataType:"json", success :function(data){
//追加下页内容
})
}
}
var windowHeight = 0; if (document.compatMode == "CSS1Compat") {
windowHeight = document.documentElement.clientHeight;
} else {
windowHeight = document.body.clientHeight;
}
return windowHeight;
}
//滚动条滚动高度
function getScrollHeight() {
var scrollHeight = 0, bodyScrollHeight = 0, documentScrollHeight = 0;
if (document.body) {
bodyScrollHeight = document.body.scrollHeight;
}
if (document.documentElement) {
documentScrollHeight = document.documentElement.scrollHeight;
}
scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight; return scrollHeight;
}
//文档高度
function getDocumentTop() {
var scrollTop = 0, bodyScrollTop = 0, documentScrollTop = 0;
if (document.body) {
bodyScrollTop = document.body.scrollTop;
}
if (document.documentElement) {
documentScrollTop = document.documentElement.scrollTop;
}
scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop; return scrollTop;
}
var p = 1 ;
window.onscroll = function () {
//监听事件内容
if(getScrollHeight() == getWindowHeight() + getDocumentTop()){
str = "";
//当滚动条到底时,这里是触发内容
//异步请求数据,局部刷新dom
//if(tag==1) return false;
p++;
fyurl = "请求翻页的接口地址?p="+p; //p为当前页数
$.ajax({url:fyurl,type : "get",async : false,dataType:"json", success :function(data){
//追加下页内容
})
}
}
0 0
- 页面滚动条翻页
- 滚动条VS翻页
- 页面打开滚动条
- 页面元素滚动条
- HTML 页面滚动条
- 实现页面滚动条
- 禁用页面滚动条
- 设置页面滚动条
- 隐藏页面滚动条
- 页面滚动条 body的滚动条
- 页面滚动条控制详细
- 定义页面滚动条样式
- 隐藏IE页面滚动条
- html页面滚动条设置
- HTML页面滚动条定位
- 给页面添加滚动条
- 页面中滚动条属性
- 页面纵向滚动条居中
- java.lang.OutOfMemoryError处理错误
- 在Windows安装activemq
- js之三类(冒泡,插值,二分)排序算法
- JavaScript高级程序设计(第3版)学习笔记——apply()和call()
- 面经一
- 页面滚动条翻页
- 采用dlopen,dlsym,dlclose 加载动态链接库
- 机器学习该怎么入门?
- Linux系统下openCV的配置安装及测试
- springMVC 静态资源
- 为什么实时时钟的晶振都是32.768KHZ呢
- android系统裁减之服务裁减
- LinuxC/C++编程(4)—管道通信
- LabelReader.cpp:54:9: error: 'transform' is not a member of 'std'