I’m working on a mobile/tablet-friendly layout at the moment and I’m running into an issue regarding touch/scroll events. Right now I have a sliding menu similar to Facebook’s mobile/tablet interface that slides out from the left.
I want to disable any touch presses or scrolling outside of this menu until it’s closed. Right now I’ve been testing the site in mobile/tablet Safari but I also need this to work in Android.
Is there any easy way to do this — ideally creating a listener on the body element and if the touch/scroll isn’t in the sliding menu it ignores it? I’m using the jQuery Mobile library’s touch events, so would touchstart possibly work in this case?
Ended up figuring out a way to work around it. Used the touchstart and touchmove events and checked the event.target to see if I was inside the menu, otherwise I ignored any actions if it was outside of it.