How to Disable Overscroll

1 comment

If you want the “bounce” effect when you scroll out of a webview. It actually feels better for the end user. In some specific cases you  need to disable this behavior.

function disallowOverscroll(){
  $(document).on('touchmove',function(e){
    e.preventDefault();
  });
  $('body').on('touchstart','.scrollable',function(e) {
    if (e.currentTarget.scrollTop === 0) {
      e.currentTarget.scrollTop = 1;
    } else if (e.currentTarget.scrollHeight
              === e.currentTarget.scrollTop
                  + e.currentTarget.offsetHeight) {
      e.currentTarget.scrollTop -= 1;
    }
  });
  $('body').on('touchmove','.scrollable',function(e) {
    e.stopPropagation();
  });
}

Categories: Main, MOBILE APPS

One Comment

  1. polo ralph lauren Many tkanhs for an amazing publish, may read your particular others posts. thank you your thinking on this, I soon became a lttle bit made an impact to by this article. Thanks again! You earn a good time. Has wonderful data here. I believe if more peop

    Reply

Leave A Comment

Loading...