Welcome to WebmasterWorld Guest from 54.226.60.235

Forum Moderators: open

Message Too Old, No Replies

Disable touch events - JQuery

using phonegap for iOS development

     

eawade

6:34 am on Dec 1, 2012 (gmt 0)

5+ Year Member



Not sure if this is the right area but I am having the most annoying situation. Ok, here goes. I am using a javascript based sliding menu for a mobile app. The "slider" works just like Facebook mobile, where u can click the button to show the menu on the left and click it again to close the menu. As an alternative, if u touch the still visible part of the page when the menu is showing it will also close. And that's it.

Problem: Note that I'm using Phonegap for this app. When i run the iOS simulator in Xcode all works fine EXCEPT if u swipeleft, for example, the page will move. I want to disable the swipe event all together. I have tried preventDefault, return false etc. Nothing seems to work. Again, my only goal is to disable touch events because for this app, I simply don't need em. Please see the javascript code for the menu show/hide below.

Thanks is advance. All is appreciated.

EA

Code Below....................................


$(function(){ var menuStatus;

// Show menu
$("a.showMenu").click(function(){

$('#menu').show();
if(menuStatus != true){

$(".ui-page-active").animate({
marginLeft: "170px",

}, 300, function(){menuStatus = true});
return false;
} else {

$(".ui-page-active").animate({
marginLeft: "0px",

}, 300, function(){menuStatus = false});
return false;
}

});


// Menu behaviour
$("#menu li a").click(function(){
var p = $(this).parent();
if($(p).hasClass('active')){
$("#menu li").removeClass('active');
} else {
$("#menu li").removeClass('active');
$(p).addClass('active');
}
});
});
 

Featured Threads

Hot Threads This Week

Hot Threads This Month