chinchang / hint.css

A CSS only tooltip library for your lovely websites.

Home Page:https://kushagra.dev/lab/hint/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Falls off the edge of the page

pacanukeha opened this issue · comments

If I have a hint--top or hint--right too close to the right edge or a hint--left too close to the left edge, the tool-tip is drawn outside the window.
I imagine that is tricky to fix without javascript, but it would be nice to have a hint--top and hint--bottom that draws the arrow at the right side of the hint box and has the box extend back to the left instead of out to the right. Any suggestions?

As you have mentioned, without JavaScript, its hard to do intelligent positioning of tooltips. Best way such situations can be avoided is by placing the tooltips manually on each element based on where they are located on the page.

As for your suggestion about having a bottom/top tooltip start from right and extend to left, it seems a valid requirement. I'll work on this and share how it comes up. We can have this in next release if all goes well.

I'm having this same issue. Would be nice to be able to either have:

hint--top-left

or combined:

hint--top hint--left

👍

Looking for opinions on the usage of classes for other positions.
Which one would you prefer for a top-left tooltip: hint--top-left or hint--top hint--left?

hint--top hint--left

👍 hint--top + hint--left.

I'd personally prefer hint--northwest, but that would require a breaking change due to hint--north and so on.

this is live with v2.0.0