Is there any default method to hide tooltip after a few seconds on click? I want to show it on click for 2 sec and then close it. how should i do this?
Asked
Active
Viewed 4,778 times
1 Answers
11
You need to set a timeout when the tooltip is first shown. I also like to add hideOnClick: false
so that it doesn't disappear when they click somewhere else.
Here's a complete example for you:
tippy('#button', {
trigger: 'click',
hideOnClick: false,
onShow(instance) {
setTimeout(() => {
instance.hide();
}, 2000);
}
});

NuclearApe
- 573
- 2
- 6
- 16