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");
    });
有帮助吗?

解决方案

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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top