javascript - Disable all scrolling on webpage -


i know if possible disable scrolling on webpage.

i using

html, body { overflow:hidden; } 

the issue not work on ios devices , if hold in mouse wheel , drag down can scroll, seems poor solution problem

is there way disable methods of scrolling on devices , re-enable it?

i have had exact same issue, fixed following;

var disablescroll = false; var scrollpos = 0; function stopscroll() {     disablescroll = true;     scrollpos = $(window).scrolltop(); } function enablescroll() {     disablescroll = false; } $(function(){     $(window).bind('scroll', function(){          if(disablescroll) $(window).scrolltop(scrollpos);     });     $(window).bind('touchmove', function(){          $(window).trigger('scroll');     }); }); 

the touch move bound window window scroll event not fired until touch move completed, allows smoother experience on ios!

this isn't perfect solution can 'throw' page, return desired position when throw has complete (as window scroll event fired). because ios browsers strip out lot of events performance. settimeout , setinterval functions not fire whilst page being thrown, having loop isn't option either!

see here http://jsfiddle.net/8t26k/


Comments