jquery-powertip
jquery-powertip copied to clipboard
Improvement Request: Smarter Placement When Every Placement Yields a Collision
Hi again,
As I mentioned in an earlier issue, some of my pages use very large tooltips (hover over Google and Oracle to see them). The smartPlacement feature is great, but it fails to work very well when every placement yields at least one collision. In the link above, when you hover over Google, no matter where you place the tooltip there will be at least one collision.
However, even where there must be a collision, some placements are more preferable to others. For example, if there must be a collision, then one would prefer the tooltip to be placed in such a way that the user could scroll the screen to see the entire tooltip. That way, even though the tooltip collides with the viewport, it does not collide with the browser window.
I put together a solution, by adding a new collision type that gets set when the tooltip falls outside of the browser window (as opposed to falling outside the viewport). When we're looking for the best placement, it selects the placement with either no viewport collisions, or if none exists the placement with no browser collisions.
My solution is located here
Here is a screenshot with the problem:
And here it is after applying my fix:
This might be a duplicate of issue #30. I've saved a copy of your modified version, I'll take a look at how your code works when I get a chance.