取消微信-qq等浏览器下下拉出现黑块

  1. 设置全屏



    // 禁止屏幕拖动; 并设置指定元素可以拖动;
var overscroll = function(els) {
    for ( var i=0, l=els.length; i < l ; i++ ) {
        (function(i){
            var el = els[i];
            el.addEventListener('touchstart', function() {
                var top = el.scrollTop
                    , totalScroll = el.scrollHeight
                    , currentScroll = top + el.offsetHeight;
                if(top === 0) {
                    el.scrollTop = 1;
                } else if(currentScroll === totalScroll) {
                    el.scrollTop = top - 1;
                }
            });
            el.addEventListener('touchmove', function(evt) {
                //if the content is actually scrollable, i.e. the content is long enough
                //that scrolling can occur
                if(el.offsetHeight < el.scrollHeight)
                    evt._isScroller = true;
            });
        })(i);
    }

}
// overscroll(document.querySelector('.scroll'));
document.body.addEventListener('touchmove', function(evt) {
    //In this case, the default behavior is scrolling the body, which
    //would result in an overflow.  Since we don't want that, we preventDefault.
    if(!evt._isScroller) {
        evt.preventDefault();
    }
}, { passive : false });

你可能感兴趣的:(取消微信-qq等浏览器下下拉出现黑块)