Ankit
Ankit

Reputation: 1104

right click on touch screen device

I am using http://medialize.github.io/jQuery-contextMenu/ to generate some option on right click and it is working fine on desktop browsers but it is not working on touch screen devices. what code should I add to make it work on touch devices like ipad

I am using following code for desktop

$(function(){
    jQuery.contextMenu({
        selector: '.context-menu-one', 
        callback: function(key, options) {
            window.console && console.log(m) || alert(m); */
            if(key=="delete")
            {
                //some action
            }

            if(key=="copy")
            {

                //some action              
            }

        },
        items: {
            "copy": {name: "Kopieren", icon: "copy"},
            "delete": {name: "Löschen", icon: "delete"},

        }
    });

Upvotes: 5

Views: 5629

Answers (1)

user1256752
user1256752

Reputation: 3

There is no right click feature in either iOS or Android and relying on it for any kind of function isn't a great idea if mobile users are a concern. A potential solution would be a plugin like https://github.com/pisi/Longclick to run your custom context menu on "long click"

This question may prove useful - Preventing default context menu on longpress / longclick in mobile Safari (iPad / iPhone).

Upvotes: 0

Related Questions