//prevents scrolling of the entire page after the content area rolls overvarContent = Document.queryselector (' main ');varStarty;content.addeventlistener (' Touchstart ',function(e) {starty= E.touches[0].clienty;}); Content.addeventlistener (' Touchmove ',function(e) {//High level means scrolling up //bottom position indicates scroll down //1 allowable 0 Forbidden varStatus = ' 11 '; varEle = This; varCurrentY = E.touches[0].clienty; if(Ele.scrolltop = = 0) { //disable scrolling up and down if content is smaller than the containerStatus = Ele.offsetheight >= ele.scrollheight? ' 00 ': ' 01 '; } Else if(Ele.scrolltop + ele.offsetheight >=ele.scrollheight) {//It's already rolled to the bottom. Scroll up onlyStatus = ' 10 '; } if(Status! = ' 11 ') { //determine the current scrolling direction varDirection = currenty-starty > 0? ' 10 ': ' 01 '; //operation direction and the current allowable state and operation, the result of the operation is 0, which means that the direction is not allowed to scroll, the default event is suppressed, the scrolling is prevented if(! (parseint (Status, 2) & parseint (direction, 2)) {stopevent (e); } }});
201508061129_ Mobile development-prevent touch movement resulting in the entire interface "threadbare"