浏览器开发工具是一个很棒的工具。我想知道用户是否已从浏览器控制台到达页面末尾。当我尝试使用 javascript 执行此操作时,它显示“未定义”
我们应该如何处理Ajax加载的Page?如何确定用户是否已到达 AJAX 加载页面的末尾?
最佳答案
在控制台中尝试此代码:(来源:see the link)
setInterval(function(){
var totalHeight;
var currentScroll;
var visibleHeight;
if(document.documentElement.scrollTop){
currentScroll = document.documentElement.scrollTop;
}else{
currentScroll = document.body.scrollTop;
}
totalHeight = document.body.offsetHeight;
visibleHeight = document.documentElement.clientHeight;
if (totalHeight <= currentScroll + visibleHeight ){
console.log('bottom of page');
}
}, 1000);
关于javascript - 如何通过浏览器开发工具知道用户已到达页面末尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20093595/