Question

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");
    });
Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top