4

I'm working on an iPad browser games and can't seem to lock the window. I've prevented scroll bars using typical overflow techniques, but the entire window still drags up and down (the new rubberband - type effect)

Is there a way to remove this window dragging?

Thannks

bmanderscheid
  • 125
  • 2
  • 9

1 Answers1

8

Bind to touchmove and preventDefault action which is scrolling

document.body.addEventListener('touchmove', function (ev) { 
  ev.preventDefault();
});

Or with jQuery

$('body').bind('touchmove', function (ev) { 
  ev.preventDefault();
});

EDIT: I've actually come across another solution that may be even easier, try this

body { overflow: hidden; }
Chris
  • 332
  • 3
  • 8
sciritai
  • 3,688
  • 1
  • 17
  • 22