首页 > 解决方案 > 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。

标签: javascript

解决方案


推荐阅读