4

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?

1 Answer 1

13

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);
  }
});

Not the answer you're looking for? Browse other questions tagged or ask your own question.