Seb Dammer
Seb Dammer

Reputation: 55

Closing Tooltip when new one is opened

I am looking for a possibilty to make a tooltip close automatically when a new one is opened. I am using Primefaces 6.1.

    <p:tooltip for="clientName" showEffect="clip" hideEvent="dblclick" 
     position="bottom">

At the moment it works like this: Mouseover on a label from my datatable and the tooltip opens. When I double click on the label which opened it, the tooltip disappears. But the problem is that I can accidently open like 30 tooltips at the time, just by moving over several datatable entrys.

Short: I only want a single tooltip to be opened at the time. But I dont want the tooltip to close by an MouseLeave event.

Im happy for any suggestions. Thanks.

Upvotes: 0

Views: 672

Answers (1)

Kukeltje
Kukeltje

Reputation: 12337

Use the onShow or onBeforeShow attribute of the tooltip which is according to the PrimeFaces documentation (page 542 on in the 6.1 docs)

onShow Client side callback to execute after tooltip is shown.

beforeShow Client side callback to execute before tooltip is shown. Returning false will prevent display.

In that you can call any javascript (jquery) to hide all other tooltips.

But why not use a showDelay of e.g. 500 ms instead of the defaul 150?

Upvotes: 1

Related Questions