Z
Z
z_u_l2020-04-15 17:26:26
JavaScript
z_u_l, 2020-04-15 17:26:26

What needs to be fixed so that the tooltip does not jump every time?

Hello! There is a hint, there is js for this hint, which, as planned, should: tooltip.getBoundingClientRect().left < 0, the 'm-left' class is added to the plate. Now the class is added, and then removed, and so on. What value do I need to remember in the if (posLeft < 0) condition?
And another question, what do I need to compare window.innerWidth with to determine that this plate does not go beyond the right border of the screen? Now, for example, I set posLeft + tooltip.clientWidth + 26, it seems to work, but not always, what calculation should be there? Please help me figure it out.

Link to example

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rasschitai, 2020-04-15
@z_u_l

forget it) put tippy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question