문제

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