javascript - javascript检测到达底部移动
问题描述
window.addEventListener('touchmove', handleScrollMobile)
return () => window.removeEventListener('touchmove', handleScrollMobile)
function handleScrollMobile() {
if (window.innerHeight + document.documentElement.scrollTop !== document.documentElement.offsetHeight || isFetching) return
setIsFetching(true)
}
此代码在桌面 chrome 移动视图上运行良好,但在我的 android 手机上不起作用。每次用户到达页面底部时,代码都会将“setIsFetching”设置为 true。
解决方案
推荐阅读
- java - 从 Number jackson 反序列化的方法
- python - Selenium webdriver 在单元测试期间使 Firefox 崩溃
- javascript - Iterating over an array of objects, summing values with the same index, and returning a new array of objects
- php - Problems with routing using.htaccess and localhost url
- mysql - 无法在 Mysql Docker 容器中安装 mysql2 gem:无法构建 gem 原生扩展
- c# - 将文件拆分成块
- amazon-web-services - 带一个浮点数的 AWS 存储
- macos - Neovim 不能在 mac 上运行
- css - wordpress 编辑器中出现意外的标记 1fr
- mongodb - 使用pymongo在mongodb中一起更新和插入?