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!
function pleaseClose(){
ToolqTip.hide()
}
should do it...
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
function pleaseClose(){
$(ToolqTip).qtip('toggle', 'false');
}
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.