解决ios浏览器页面滚动到底部或顶部后,页面局部滑动失效的问题

/** 解决 ios浏览器页面滚动到底部或顶部后 导致页面局部滑动失效的问题*/
    function iosTrouchFn () {
        var ios = navigator.userAgent.indexOf('iPhone'); // 判断是否为ios
        if (ios !== -1) { // ios下运行
            var el = document.querySelector('body'); // el -- 需要滑动的元素
            el.addEventListener('touchmove', function (e) {
                if (el.offsetHeight < el.scrollHeight)  e.isSCROLL = true;
            });
            document.body.addEventListener('touchmove', function (e) {
                if (!e.isSCROLL) e.preventDefault(); // 阻止默认事件(上下滑动)
            });
        }
    }
原文地址:https://www.cnblogs.com/wuhuanan/p/14073848.html