PC上css控制滚动仅css("overflow","hidden")已足够。css
可是,若是在Mobile上仍是能够拖动的!因此须要监听touchmove事件。html
页面禁止拖动、滚动:ajax
$("html,body").css("overflow","hidden").css("height","100%"); document.body.addEventListener('touchmove', self.welcomeShowedListener, false);
恢复页面拖动、滚动:ui
$("html,body").css("overflow","").css("height",""); document.body.removeEventListener('touchmove', detail.welcomeShowedListener, false);
参考:spa
在移动端设置overflow:hidden为何页面还能滚?要怎么禁止.net
移动端的touch事件处理code