I have been struggling for weeks upon weeks upon mind bending, agonizing weeks to solve what I would think to be a simple javascript problem. I needed a popup box to come up just left and center of another element. Well I searched through results provided by Google and Yahoo! and found a number of solutions that didn’t work for my particular situation. However, those examples provided a stepping stone for me to figure out how to position it where I wanted. The next problem was re-positioning the popup if it went beyond the top or bottom edge of the window viewport. This is where jQuery came to the rescue. If I had discovered this earlier, a lot of headache would have been prevented and I would have more hair.
jQuery has this: $(“#popup”).offset(), which returns the elements absolute top and left positions no matter where they are in the page and no matter how many elements they are nested in.
Thanks to smart people.