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

  • Home
  • SEARCH
  • 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 6649827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:49:14+00:00 2026-05-26T00:49:14+00:00

guys i need a help im having a hard time to get the formula

  • 0

guys i need a help im having a hard time to get the formula to center this modal (http://www.queness.com/post/77/simple-jquery-modal-window-tutorial) my browser size is 1263X582, Im solving it by using the formula in the jquery

    $(id).css('top',  winH/2-$(id).height()/2);
    $(id).css('left', winW/2-$(id).width()/2);

so basically i would end up with 1263/2 – 395/2 for the top and 582/2 – 223/2 for left then i end up TOP:179.5 LEFT:434 but when I inspect element the site and check if Im correct it gives me a different answer. i just want to know if my solving is correct, or what is the proper solving for this one.

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-05-26T00:49:14+00:00Added an answer on May 26, 2026 at 12:49 am

    The formula seems fine, just make sure that you are getting the right size for winH, winW and your modal dimensions.

    If the modal is not visible, you’ll get 0, or if it’s not within your document window it will have a weird shape.

    Also consider that height() and width() doesn’t consider padding, but outerWidth() does.

    Tip:
    Store $(id) inside another variable to optimize your jQuery queries.

    var modal = $(id);
    modal.css('top', winH/2 - modal.height()/2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Guys i need some help here , im getting this error here at the
Hay guys i need help on a regex. I'm using file_get_contents() to get the
Hey guys, i'm having some trouble with this: In the object consumer i need
Am new to this guys need your help! Am trying to multiply two field
I really need help with interfaces in general... Any resources that you guys would
Hay guys, i need help with a REGEX. I have the got the value
I have a small problem which I'm having a hard time troubleshooting. I just
Hey guys. I need help for a project for school. Essentially, I need to
I have a minor problem guys which I need some help. I have a
Alright guys, Need some help! Im working with asp.net mvc3 razor (and am fairly

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.