Tooltip negative positions. #801

Open
Blueowner opened this Issue Aug 11, 2016 · 0 comments

Projects

None yet

1 participant

@Blueowner

Hello,
I'm new to the library and I've found out that in certain situations the tooltips go outside of the viewport, even with position: { viewport: $(window) }. I'm not sure why this happens.
I had to push an hotfix and solved it by making sure position.left was always positive (just above line 890: https://github.com/qTip2/qTip2/blob/9ed19816c44514cab5eb1913c51d7b405c53e90e/dist/jquery.qtip.js#L890)

if (position.left < 0) {
  position.left = 0;
}

My question is, would it make sense to allow to pass a boolean or a callback function to forbid negative values?

position: {
  // As a boolean
  withNegative: false,
  // or callback
  onReposition: function(position) {
    if (position.left < 0) { position.left = 0; }
    return position;
  }
}

I've only tested always-positive positions with viewport: $(window).

Is there any downside with always-positive position.left if the target's container is window or document?

I've made a JSFiddle to show the issue: https://jsfiddle.net/gyuebqsw/

screen shot 2016-08-11 at 14 11 39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment