本文介绍了js实现滑动荷载数据的一种简单方法,供大家参考,如下:


幻灯片
getscrolltop()函数
{
VaR scrollTop = 0;
如果(document.documentelement文档。文档元素}。scrollTop){
scrollTop = document.documentelement.scrolltop;
}如果(文档体){
scrollTop = document.body.scrolltop;
}
返回scrollTop;
}
获取当前高度的可视范围
getclientheight()函数
{
var自己= 0;
如果(document.body.clientheight文档。文档元素}。自己){
自己= Math.min(document.body.clientheight,文档。文档元素}。自己);
{ }人
自己= math.max(document.body.clientheight,文档。文档元素}。自己);
}
返回自己的;
}
获取完整的高度
getscrollheight()函数
{
返回math.max(document.body.scrollheight,文档。文档元素}。scrollheight);
}
绑定事件
window.onscroll =功能()
{
如果(getscrolltop)(getclientheight)(+)(= = getscrollheight){
/ /做
}
}




更多有关Javascript相关内容的读者可以看到特别站:Javascript切换效果和技巧摘要

希望本文能对javascript程序设计有所帮助。