Disable iOS Overscroll but allow body scrolling

前端 未结 2 1558
臣服心动
臣服心动 2020-12-15 01:50

I would like to disable the iOS overscroll in a webapp but still allow the body to be scrolled.

$(document).on(\'touchmove\', function(e) {
    e.preventDefa         


        
相关标签:
2条回答
  • 2020-12-15 02:18
    document.body.addEventListener('touchmove',function(e){
         if(!$(e.target).hasClass("scrollable")) {
           e.preventDefault();
         }
     });
    

    Try this i just got in via google

    0 讨论(0)
  • 2020-12-15 02:37

    I had pretty much the same issue. This should help you:

    // Disable overscroll / viewport moving on everything but scrollable divs
     $('body').on('touchmove', function (e) {
             if (!$('.scrollable').has($(e.target)).length) e.preventDefault();
     });
    
    0 讨论(0)
提交回复
热议问题