SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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?

  2. #2
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sounds like you need a floating pop up

  3. #3
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Changing it from absolute to fixed was all that was needed, it's now working perfectly. Thanks all!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •