views:

71

answers:

2

Hello!

I am looking for a very simple solution (using jQuery) to let a small popup div appear next to whatever link I click. I know how to make divs show and hide but the problem is I do not know how to make them appear just next to the link I called them from.

It would be perfect if I could use the same div for all the popups no matter which link I click. I am not looking for a finished plugin only this basic functionality.

I am lost on this one.

Please help!

+1  A: 

If you don't want to use a plugin (and qTip sounds perfect for this) you could do it a few ways: with CSS or using jQuery's offset().top and similar to position.

The easiest would be to use CSS. Append an element to the link (or make a wrapping element for your link and append a child) and set the new element's position to absolute, and the parent's to relative. Then you can simply manipulate the left, right, top or bottom properties to place the popup.

alex
I got a table with 2000 cells. When I click on a cell I want to div to popup and display links. I do not know if I could use positioning on a table.
Jonathan Clark
@Jonathan It should work. If not, wrap the table's direct contents with a `div` using jQuery, and then set that `div` to `position: relative`. This will act the parent container for the child of which has `position: absolute`.
alex
@alex will it set on top of the cell or in the cell (I need it to be on top)?
Jonathan Clark
You can change that with the 'top' property. You can make it negative too.
alex
+1  A: 

The moment you get the actual popup working, you're gonna start thinking about formatting, putting the contents of full web pages inside those DIVs, and more.

Don't mess around ... get QTip. We did and we are very happy.

Billy Barnum
+1, qTip works great.
jhanifen