kazzkiq / balloon.css

Simple tooltips made of pure CSS

Home Page:https://kazzkiq.github.io/balloon.css/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exclude Selector

Aniruddh-J opened this issue · comments

Hello,

Thanks for the awesome tooltip.

Is it possible to add an exclusion selector so that hovering over the excluded selector doesn't trigger the tooltip?

Balloon.css only triggers when using both aria-label and data-balloon-pos together. I can't actually see a reason to prevent those two attributes from triggering a tooltip, since you could simply remove one of them to prevent it triggering.

That being said, you could make your own CSS to achieve that behavior:

.exclude[aria-label][data-balloon-pos]:before,
.exclude[aria-label][data-balloon-pos]:after {
  display: none !important;
}

So now whenever you use the class exclude your element won't show the tooltip.

Example: https://jsfiddle.net/b2g6kze1/

@kazzkiq Actually, I did exactly that except, I did opacity: 0 which did the trick for me.

The reason I had to do this is because parent of the element has a tooltip and child also has one. Hovering over the child also triggers parent tooltip and I wanted to avoid that.

So, I added CSS:

.notip[aria-label][data-balloon-pos]:before,
.notip[aria-label][data-balloon-pos]:after {
    opacity: 0 !important;
}

and using jQuery I added notip on parent when mouse is hovered over child. :)