javascript - prevent window from dragging in ios5 mobile browser - Stack Overflow

I'm working on an iPad browser games and can't seem to lock the window.I've prevented

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

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

Share Improve this question asked Jan 8, 2012 at 22:38 bmanderscheidbmanderscheid 1252 silver badges9 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 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 e across another solution that may be even easier, try this

body { overflow: hidden; }

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742335306a4424530.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信