I'm using tooltipster to build some call-outs. I've some on click, some on hover.
JS:
var instances = $.tooltipster.instances();
$('.mgu-click').tooltipster({
functionBefore: function(instance, helper) {
$.each(instances, function(i, instance) {
instance.close();
});
},
contentCloning: true,
trigger: 'click',
'maxWidth': 280,
'minHeight': 280,
animation: 'grow',
interactive: true,
arrow: false,
distance: -10,
contentAsHTML: true,
theme: 'tooltipster-shadow'
});
$('.mgu-hover').tooltipster({
functionBefore: function(instance, helper) {
$.each(instances, function(i, instance) {
instance.close();
});
},
contentCloning: true,
trigger: (browser.hasTouchEvents()) ? 'click' : 'hover',
'maxWidth': 280,
'minHeight': 280,
animation: 'grow',
interactive: true,
arrow: false,
distance: -10,
contentAsHTML: true,
theme: 'tooltipster-shadow'
});
If you click or move to a tooltipster-btn all other should close before the selected open. The functionBefore work fine with the trigger: click. But if i call the one with trigger hover, all other dont close.
thanks for help
It looks like you need to call the $.tooltipster.instances()
method within the functionBefore
function for a reference to the latest instances:
functionBefore: function(instance, helper){
$.each($.tooltipster.instances(), function(i, instance){
instance.close();
});
}
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.