iOS Safari – How to disable overscroll but allow scrollable divs to scroll normally?

后端 未结 14 1579
南方客
南方客 2020-11-28 17:50

I\'m working on an iPad-based web app, and need to prevent overscrolling so that it seems less like a web page. I\'m currently using this to freeze the viewport and disable

14条回答
  •  攒了一身酷
    2020-11-28 18:08

    I had surprising luck with with simple:

    body {
        height: 100vh;
    }
    

    It works great to disable overscroll for pop-ups or menus and it doesn't force browser bars to appear like when using position:fixed. BUT - you need to save scroll position before setting fixed height and restore it when hiding the pop-up, otherwise, browser will scroll to top.

提交回复
热议问题