Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent browser pop on taphold event

In a jquery-mobile based web app, how do i prevent the default browser menu from showing on "tap hold" .. instead i want to show a custom dialog page ..

mentioned below is my code as of now ..

$(".task_row").bind('taphold',function(event, ui){
    event.preventDefault();
    $("#slide_down_menu").trigger('click');
});
like image 215
Abhishek Jain Avatar asked May 02 '11 15:05

Abhishek Jain


2 Answers

use css:

a {
    -webkit-touch-callout: none !important; 
}

to not show the standard dialog

like image 160
axel freudiger Avatar answered Sep 26 '22 18:09

axel freudiger


I found out you have to disable right-clicking.

$(function(){

    document.oncontextmenu = function() {return false;};

    $(document).mousedown(function(e){

        if ( e.button == 2 )
        { 
            alert('Right mouse button!'); 
            return false; 
        }

        return true;
    });
});
like image 23
bafromca Avatar answered Sep 22 '22 18:09

bafromca