-webkit-overflow-scrolling: touch; breaks in Apple's iOS8

前端 未结 10 1399
刺人心
刺人心 2020-11-30 20:19

I\'m working on a web app that uses -webkit-overflow-scrolling:touch in several places to give the overflown divs inertia scrolling.

Since updating to I

10条回答
  •  忘掉有多难
    2020-11-30 20:46

    Preventing touch events from surrounding elements bubbling up the DOM is another potential solution, you may notice that scrolling stops when surrounding DIV elements receive the touch or drag events. We had this particular issue in a menu that needed to scroll smoothly. Turning off those events helped stop the "sticking" of the scroll able element.

    $html.bind('touchmove', scrollLock );
    
    var scrollLock = function(e) {
            if( $body.hasClass('menu-open') ){
                    e.stopPropagation();
                    e.preventDefault();
            }
    };
    
    $html.unbind('touchmove', scrollLock );
    

提交回复
热议问题