Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8935201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:56:33+00:00 2026-06-15T09:56:33+00:00

I am creating a feedback system for one of my projects. My target device

  • 0

I am creating a feedback system for one of my projects. My target device is iPad. Basically what happens is a div called into the page via ajax and it is supposed to overlay the content underneath. I have that part working.

What I want to do is have the div locked to the middle of the view-port. I have tried position:fixed on my element which works, except it will lock into the wrong position. It seems to be centering itself to the initial position of the viewport. If I scroll down to the bottom of a longer page and call my feedback window, it will still be near the top.

Ajax Page (this runs when the page is called)

$(document).ready(function(){
  $(".popup").css({
    top: "50%",
    left: "50%",
    marginLeft: -$(".popup").width() / 2,
    marginTop: -$(".popup").height() / 2
  });
});

If I can find the top of the viewport I think I’d be able to get this working right.

I’ve looked into: http://www.appelsiini.net/projects/viewport but it doesn’t really solve my problem.

Any help, advice or pointers in the right direction would be greatly appreciated! Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:56:34+00:00Added an answer on June 15, 2026 at 9:56 am

    Fixed positioning is applied relative to the top-left corner of the window, regardless of how far down you’re scrolled (which I assume is what you want).

    So:

    .popup {
       position:fixed;
       top:20px;
       left:40px;
       right:40px;
    }
    

    Will, first of all, put your popup 20px from the address bar (meaning, even if you scrolled to the bottom).

    Next, setting both left AND right will “stretch” the fixed element to start and end 40px (or whatever you give it) from both sides of the window. That’s a convenient way of centering this popup div.

    If your popup needs to be a fixed size – not stretched based on the width of the window – you could set both the left and right (to zero probably) and then inside this div, have another div with margin:0 auto, which will center that inner div within the fixed outer div.

    P.S.
    Just as you can set both left and right, you can also set both top and bottom, which will have corresponding results. However, if you need a fixed height, you won’t be able to vertically center it using the margin:auto trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a feedback system kind of like eBay. (Once you buy the item
compliment of the day. Based on the previous feedback received, After creating a Ticket
I'm currently creating a stock management system that uses multiple warehouses (with sub locations)
I am creating my second iPhone app, and I've included a feedback form using
I'm creating my own skin for subtext, and there's one thing I can't figure
I'm designing a system to process plain text files, one of its features will
I'm creating a very simple chat application. It has an ASP.NET web page as
Right now I'm creating an application for WP7 and have recieved alot of feedback
I am currently creating a class for a small project and ran into an
I am creating a simple RESTful interface on one of my apps and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.