0

我使用 asp.net mvc 剃须刀代码。我使用 qtip 在鼠标悬停时显示弹出窗口。我在设置页面中有一个复选框,用于启用/禁用 qtip。

这是我的代码:

function tooltip(a) {
    Sapppid = document.getElementById("s" + a).textContent;
    Sapppid = Sapppid.replace("s", "");
    $.ajax({
        url: window.location.pathname + "Scheduler/getappointmentdetails",
        type: "POST",
        data: { sharedappid: Sapppid }
    })
    .success(function (result) {
        document.getElementById('ApptDetails').value = result;
    });

    $("#" + a).qtip({
        overwrite: false,
        content: {
            text: "...",
            button: 'Close',
            ajax: {
                url: window.location.pathname + "Scheduler/Eventdetails/" + Sapppid,
                type: 'Post',
                success: function (result) {} 
            } 
        },
        style: {
            classes: '',
            width: 500
        },
        position: {
            my: 'right bottom center',
            at: 'middle right center',
            target: $("#" + a)
        },
        show: {
            ready: true,
            solo: true
        },
        hide: {
            when: { event: 'mouseout unfocus' }, fixed: true, delay: 200
        }
    });   
}

我设计 qtip 以显示在动态内容上。我使用qtip2。我在站点中找不到任何要禁用或启用的文档。

这是我找到的唯一代码,但无法弄清楚在哪里应用它。:

http://qtip2.com/api#api.disable

api.disable(true);

// Enable it again
api.disable(false);
4

2 回答 2

2

将 onclick 事件附加到您的复选框,并将禁用放在您要定位的元素上的 qtip 函数中

代码示例:

$('.checkbox').on('click', function(){
    $('.dynamic').qtip('disable', true);
});

试试这个,让我知道它是否在评论中有效

于 2013-10-11T08:26:03.933 回答
0

尝试这样的事情

    $('.checkbox').on('click', function(){
        var api = $('.dynamic').qtip('api');
        api.disable(true);
    });
于 2013-10-11T08:36:17.877 回答