数码资讯
js示例滑动载荷数据的简单实现
本文介绍了js实现滑动荷载数据的一种简单方法,供大家参考,如下: 幻灯片 getscrolltop()函数 { VaR scrollTop = 0; 如果(document.documentelement文档。文档元素}。scrollTop){ scrollTop = document.docume
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
本文介绍了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程序设计有所帮助。
幻灯片
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程序设计有所帮助。
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。