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();
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With