javascript - How to determine if tooltip is cut off from the top of a page -


I have a tooltip that opens with javascript on mouseover. How can I determine from the following values ​​that this tooltip is cutting from the top edge of the screen (in this case it is):

  Top margin: 72.5 Internal height: 607 offsettop: 75 Offset Hight: 26   

And here are values ​​from a tooltip that is not cut, and fits perfectly in the window: Top margin: 53.5 Internal height: 607 offsettop: 20 9 Offset Hight: 222

I have to find out that the tip cut off And then want to apply the change in margins to push it down to fit on the screen.

  if (left + width> viewport wide || top + height> view port heading) { // viewport off}    

Comments