calebjacob / tooltipster

A jQuery tooltip plugin
MIT License
2.76k stars 482 forks source link

size of tip in position variable incorrect in functionPosition call #794

Closed sderrick closed 4 years ago

sderrick commented 4 years ago

I need to reposition the tip and was trying to use the functionPosition. I am using the this test to determine if I'm overlapping

   if(position.coord.top + position.size.height > ifrm.clientHeight)

The problem is position.size.height, always shows the height as 40, on the first click. Subsequent clicks show the correct height.

here are the settings for the tip

  theme: 'tooltipster-light',
  contentAsHTML: true,
  maxWidth: 500,
  trigger: 'custom',
  side: 'bottom',
  animation: 'grow',
  interactive: true,
  contentCloning: true,
  content: 'Loading...',

how do I get the correct height on the first click

louisameline commented 4 years ago

This is due to your content. Please read the FAQ about the positioning issue at firt rendering, you'll understand. Thank you

sderrick commented 4 years ago

There are no images in the tip, however they are all loaded with an ajax call using the functionBefore call. Since there is no image loading and all the tips are different sizes, I'm not sure how to get functionPosition called after the content has been loaded so I can decide to move the tip or not?

sderrick commented 4 years ago

I tried functionReady, and had the same issue as functionPosition, size of content is still unknown.

sderrick commented 4 years ago

I found a solution that doesn't require me to manually reposition teh tip. thanks for a great tooltip, Scott

louisameline commented 4 years ago

Glad you could make it work! You're welcome.