Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 123
Registered: ‎03-22-2011
My Device: curve 8900
My Carrier: Rogers

Playbook - Prevent scrolling

Hey guys,

 

I'm trying to "lock" the screen into place so that users can't scroll on their own but I haven't had any success. Right now my app navigates from screen to screen by clicking on buttons.

 

I've tried this to stop the scrolling but it didn't quite work out

 

 

document.ontouchmove = function(event) {
    event.preventDefault();
}
document.ontouchend = function(event) {
   event.preventDefault();
}

 

If I drag really fast I'm still able to scroll somewhat.. any ideas what I could be doing wrong?

 

--
Bitbox
Highlighted
Developer
Posts: 610
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: PB - Playbook - Prevent scrolling

You are missing the following

 

 

// don't forget the ontouchstart method!!!

document.ontouchstart = function(event) {
   event.preventDefault();
}

document.ontouchmove = function(event) {
   event.preventDefault();
}

document.ontouchend = function(event) {
   event.preventDefault();
}

 

This should do the trick.