homepage Welcome to WebmasterWorld Guest from 54.197.15.196
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Disable touch events - JQuery
using phonegap for iOS development
eawade

5+ Year Member



 
Msg#: 4524082 posted 6:34 am on Dec 1, 2012 (gmt 0)

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');
}
});
});

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved