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

后端 未结 14 1576
南方客
南方客 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:01

    Here's a zepto compatible solution

        if (!$(e.target).hasClass('scrollable') && !$(e.target).closest('.scrollable').length > 0) {
           console.log('prevented scroll');
           e.preventDefault();
           window.scroll(0,0);
           return false;
        }
    

提交回复
热议问题