When using Quora, there is a feature that displays a pop-up card when you hover over a username or picture. This card will always stay within the visible window area and adjust its position based on the screen size.
For example, take a look at these Quora screenshots. The first image shows the hover card on the right side with higher resolution, while the second image shows it on the left after zooming in.
I'm curious about how to implement this functionality myself. Any tips?