简体   繁体   中英

Enable or disable qtip on checkbox

I use asp.net mvc razor code. I use qtip to give a show popup on mouseover. I have a checkbox in the settings page,which is used to enable/disable the qtip.

Here is my code:

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
        }
    });   
}

I design qtip to showup on a dynamic content. I use qtip2. I din't find any documentation to disable or enable in the site.

This is the only code i found, but couldnt figure out where to apply this.:

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

api.disable(true);

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

attach an onclick event to your checkbox and place the disable within the qtip function on the element you're targetting

Code Example:

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

Give this a try and let me know if it works in the comments

try something like this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM