Reputation: 3125
I'm dynamically generating a qTip2 tooltip and I want to close/hide it from a javascript function, how can i do that? any idea?
This is how I generate the qTip2:
var ToolqTip = $('<div />').qtip({
content: {
text: this.html,
title: {
text: currentItem["Item"].name,
button: true
}
},
position: {
at: "right center",
my: "left center"
//target: $("#location_header")
,adjust: {
method: "flip shift",
x: 15, y: -25
}
,target: pos
//,viewport: $('#map_canvas')
//,container: $('#map_canvas') // this one prevents overlaping
},
show: {
ready: true,
event: false,
solo: true
},
style: {
classes: 'ui-tooltip-shadow ui-tooltip-jtools'
}
/*,
hide: {
event: 'mouseleave unfocus'
}*/
});
I want to close it from a call from this function
function pleaseClose(){
$().qtip('hide'); // NOT WORKING :(
}
any idea? Please!
Upvotes: 0
Views: 3768
Reputation: 3527
You can you an API call to toggle visibility
function pleaseClose(){
var api = $('yourSelector').qtip();
api.toggle(false); //hide
};
To show:
api.toggle(true); //show
Upvotes: 0