Jonathan Clark
Jonathan Clark

Reputation: 20538

Make div popup next to a link

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.

Upvotes: 1

Views: 3639

Answers (2)

Billy Barnum
Billy Barnum

Reputation: 11

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.

Upvotes: 1

alex
alex

Reputation: 490143

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.

Upvotes: 1

Related Questions