Placing a pop-up window (div) near the clicked link
Posted on 2009-04-22
We have a website that is sometimes viewed from within an iFrame and sometimes not.
This page has a pop-up that appears, say it's 800px wide and 600px tall.
The pop-up will open by clicking the product name of a long list of products (say 500 products listed on a long scrolling page)
I need to figure how to make the pop-up appear in the window somewhere near the link that was clicked.
Right now, the pop-up appears centered horizontally and vertically. So, that means if you click the third link on a long page, you have to scroll way down the page to see the pop-up - because it opens in the center of the iFrame which is really tall.
Can you help me with a formula that will help me determine the correct X and Y coorindate to display the pop-up so that it will appear near the link whether that link is on a page within a tall iFrame or just on a page...