chrisdavies / tlite

A tiny tooltip utility library.
https://chrisdavies.github.io/tlite/
90 stars 19 forks source link

Doenst seem to work in a table cell #2

Closed El4a closed 5 years ago

El4a commented 8 years ago

Okay, this time an actual issue =)

It seems that if I use the library with the test example and I add a table cell with a tooltip, for example

  <table>
    <tr>
      <td class="tooltip-n" title="test the tooltip">Tooltip will appear on the wrong place</td>
    </tr>
  </table>

the tooltip appears on the wrong position (usually somewhere top left).

El4a commented 8 years ago

Nevermind! Someone fixed it for me :) I'll just add table tr td{position:relative;}

to the styling. Is it okay if I commit this on the git?

El4a commented 6 years ago

I just discovered that when you add "position:relative" to any element, the tooltip will take the width of the parent element. This causes problems with small elements, like table elements sometimes. I can't seem to find what causes this behaviour.

chrisdavies commented 5 years ago

Yeah. It's true. It's a tradeoff I made because the only alternative I could think of was to use fixed positioning and manually calculate where to put it. That causes complications on resize, flow changes, etc, so it's "by design", for better or worse. :/

El4a commented 5 years ago

Okay I see, however, I think I have a solution that requires little extra and still doesn't ruin the other features. Would you be okay with a pull request to check it out and see if you like it?