How to disable scrolling in smartphone and tablet browsers?

I use the following code to disable scrolling in desktop browsers but it doesn't work for iPhone screen resolution.

$("html").css("overflow", "hidden");

What else do I need to add?


//target the entire page, and listen for touch events
$('html, body').on('touchstart touchmove', function(e){ 
     //prevent native touch activity like scrolling

if having the touch event blocked doesn't work for you, you can always go like this:

html, body{

I'm gonna provide an a piece that doesn't utilize jQuery so the next "Javascripter" can just copy'n'paste:

var defaultPrevent=function(e){e.preventDefault();}
document.body.parentElement.addEventListener("touchstart", defaultPrevent);
document.body.parentElement.addEventListener("touchmove" , defaultPrevent);
document.body.addEventListener("touchstart", defaultPrevent);
document.body.addEventListener("touchmove" , defaultPrevent);

Need Your Help

Draw Text on Canvas at Angle

java android paint android-canvas

How can i draw text on canvas as shown in below image highlighted in Green rectangle .

Build Maven Project Without Running Unit Tests

unit-testing maven-2

How do you build a Maven project without running unit tests?