stevenbenner / jquery-powertip

:speech_balloon: A jQuery plugin that creates hover tooltips.
https://stevenbenner.github.io/jquery-powertip/
MIT License
821 stars 137 forks source link

Stays visble when manually triggered and switching tabs using Bootstrap tabs #94

Closed NoFunction closed 11 years ago

NoFunction commented 11 years ago

The tooltip stays visible if you use and trigger it manually on an element under a Bootstrap tab and then switch to another tab due to the tooltip element being appended to the body but not next to or under the same parent as the target element.

stevenbenner commented 11 years ago

This is expected behavior. The best place for the tooltip element in the document is as a direct descendant of the <body> tag to avoid a host of possible problems that can be caused by CSS rules applied to the tooltip's parent.

I took a quick look at the bootstrap togglable tabs documentation and they do have custom events that you can attach code to. This means that you should be able to call the PowerTip API and close the tooltip when a tab is clicked.

Example:

// close any open tooltips when switching tabs
$('a[data-toggle="tab"]').on('show', function() {
    $.powerTip.hide();
});

Of course this code is completely untested, but I think it should work.

stevenbenner commented 11 years ago

Since there hasn't been a response in over a week I'm going to close this issue. I hope that my suggestion was helpful, if not please feel free to reply back to this issue and I'll reopen it if needed.