How to programmatically disable page scrolling with jQuery

后端 未结 23 2463
滥情空心
滥情空心 2020-11-22 08:09

Using jQuery, I would like to disable scrolling of the body:

My idea is to:

  1. Set body{ overflow: hidden;}
  2. Capture the current
23条回答
  •  感动是毒
    2020-11-22 08:21

    I am using the following code to disable scrolling and it works fine

        $('html').css({
          'overflow': 'hidden',
          'height': '100%'
        });
    

    except that on my android tablet, url address bar and top window tags remain visible, and when users scroll up and down, the window also scrolls for about 40px up and down, and shows/hides the url bar and the tags. Is there a way to prevent that and have scrolling fully disabled ?

提交回复
热议问题