Centered popup is wrong if they've scrolled down

I have a popup div that appears after 30 seconds, right in the middle of the browser window. It’s positioned like this, which works great:

#my_form {
width: 520px;
height: 270px;
position: absolute;
top: 50%;
left: 50%;
margin-left: -260px;
margin-top: -140px;
z-index: 99;

The problem is that some pages are long, and the user has probably scrolled way down during the 30 seconds. I’d like it to appear in the center of the browser window no matter how far they’ve scrolled down. Any suggestions?

sounds like you need a floating pop up

Changing it from absolute to fixed was all that was needed, it’s now working perfectly. Thanks all!