concept collision detection in category jQuery

This is an excerpt from Manning's book jQuery UI in Action.
That’s all there is to detecting a drop. The widget handles all the complex mouse events and collision detection for you. Although this example shows what you can accomplish with a small amount of code, chances are you’ll need to build something more complex than a box that turns red. To build something more useful, and to show off what draggable and droppable make possible, let’s build something fun—a game.
Positioning an element relative to another element on the web is surprisingly hard. Besides the brute-force mathematical computations—comparing heights, widths, and offsets—you also have to worry about CSS positioning mechanisms (static, relative, absolute, and fixed), not to mention accounting for the window’s scroll offset, or collision detection if the element doesn’t fit.
In chapter 7, you saw how to build tooltips with arrows that pointed at their corresponding element (which was an <input>). Also remember that, to ensure that the arrows always displayed on the correct side of the tooltip, you had to turn the position utility’s collision detection off.
Although turning collision detection off does keep the arrow pointing at the element appropriately, it also means that the tooltip can potentially display outside of the screen. You know now that you can use the position utility’s flip collision mechanism to move the arrow tooltip above or below the <input>. But that leaves a problem. You used CSS to draw the arrow, and you need to alter the CSS based on whether the tooltip is above or below the <input>. To make this possible, the position utility exposes this information to the using property. Before we show this in action, first remember that your example from chapter 7 used the following HTML: