Domanda

this code work 100% in "google Chrome Browser" but its not working on "Firefix" how i solve this problem?

    $(".one_post").click(function() {

    switch (event.which) {
        case 1:
            window.document.location = $(this).attr("href");
            break;
        case 2:
            $(this).target = "_blank";
            window.open($(this).attr("href"));
            break;
        }
    });

     $(".os_new_ads_lis_city").click(function() {
        window.document.location = $(this).attr("href");
    });

     $(".os_new_ads_list_category").click(function() {
    window.document.location = $(this).attr("href");
    });
È stato utile?

Soluzione

Instead of click, use mousedown event, as right click opens context menu, you need to use mouse down instead of mouse click, else prevent event bubbling after right click,

$('#btn').on("mousedown",function(e){
    //  your code
});

Here is a small fiddle demo of mouse down which will help you.

Altri suggerimenti

Use mouseup or mousedown instead:

$('.one_post').mouseup(function() {
    switch (event.which) {
        case 1:
            alert('Left');
            break;
        case 2:
            alert('Middle');
            break;
        case 3:
            alert('Right');
            break;
    }
});

Here is a jsFiddle.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top